Commit 22782162 by 吴博

个人中心

parent 9d0aa9fe
......@@ -4,7 +4,6 @@ import com.pcloud.book.keywords.dto.SelfRobotBookRecordDTO;
import com.pcloud.book.keywords.entity.RobotSkill4H5;
import com.pcloud.book.keywords.entity.RobotSkillDetail;
import com.pcloud.book.keywords.entity.SelfRobotKeyword;
import com.pcloud.book.keywords.vo.GuideWordVO;
import com.pcloud.book.keywords.vo.LabelVO;
import com.pcloud.book.keywords.vo.SelfRobotReplyVO;
import com.pcloud.common.page.PageBeanNew;
......@@ -52,5 +51,5 @@ public interface SelfRobotKeywordBiz {
RobotSkillDetail getSkillDetail(Integer type, Integer relSkillId, String wxUserId,String robotWxId,Integer skillId );
String confirmSkill(Integer id, Integer type, Integer relSkillId, String robotId, String wxUserId);
String confirmSkill(Integer id, Integer type, Integer relSkillId, String robotId, String wxUserId, Integer state);
}
......@@ -29,6 +29,8 @@ import com.pcloud.book.keywords.mapper.TempRobotSkillDao;
import com.pcloud.book.keywords.vo.GuideWordVO;
import com.pcloud.book.keywords.vo.LabelVO;
import com.pcloud.book.keywords.vo.SelfRobotReplyVO;
import com.pcloud.book.personal.dao.PcloudSkillRecordDao;
import com.pcloud.book.personal.entity.PcloudSkillRecord;
import com.pcloud.book.skill.biz.PcloudGroupActivityBiz;
import com.pcloud.book.skill.biz.PcloudSubRemindBiz;
import com.pcloud.book.skill.biz.impl.PcloudSkillBizImpl;
......@@ -147,6 +149,8 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
private PcloudSubRemindBiz pcloudSubRemindBiz;
@Autowired
private PcloudSubRemindDao pcloudSubRemindDao;
@Autowired
private PcloudSkillRecordDao pcloudSkillRecordDao;
......@@ -680,10 +684,27 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
}
}
if(null != robotSkillDetail){
String filterStr = StringUtilParent.replaceHtml(robotSkillDetail.getRelSkillIntroduce());
//String subStr = filterStr.length() > 100 ? filterStr.substring(0, 100) + "..." : filterStr;
robotSkillDetail.setCutRelSkillIntroduce(filterStr);
//新增技能获取记录
PcloudSkillRecord pcloudSkillRecord = pcloudSkillRecordDao.getBySkillIdAndWxId(skillId, wxUserId);
if (null == pcloudSkillRecord) {
PcloudSkillRecord pcloudSkillRecordNew = new PcloudSkillRecord();
pcloudSkillRecordNew.setRobotWxId(robotWxId);
pcloudSkillRecordNew.setWxUserId(wxUserId);
pcloudSkillRecordNew.setSkillId(skillId);
pcloudSkillRecordNew.setSkillType(type);
pcloudSkillRecordNew.setState(0);
pcloudSkillRecordNew.setCreateTime(new Date());
pcloudSkillRecordNew.setUpdateTime(new Date());
pcloudSkillRecordDao.insertSelective(pcloudSkillRecordNew);
}else {
if (1 == type){
if (2 == pcloudSkillRecord.getState()){
pcloudSkillRecord.setState(0);
}
}
pcloudSkillRecord.setUpdateTime(new Date());
pcloudSkillRecordDao.updateByPrimaryKeySelective(pcloudSkillRecord);
}
PcloudSubRemind pcloudSubRemind = pcloudSubRemindDao.getByMap(relSkillId, type, wxUserId, skillId);
if(null==pcloudSubRemind) {
......@@ -697,12 +718,17 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
subRemind.setSkillId(Long.valueOf(skillId));
pcloudSubRemindDao.insert(subRemind);
}
if (null != robotSkillDetail) {
String filterStr = StringUtilParent.replaceHtml(robotSkillDetail.getRelSkillIntroduce());
robotSkillDetail.setCutRelSkillIntroduce(filterStr);
}
return robotSkillDetail;
}
@Override
@ParamLog("确认任务")
public String confirmSkill(Integer id, Integer type, Integer relSkillId, String robotId, String wxUserId) {
public String confirmSkill(Integer id, Integer type, Integer relSkillId, String robotId, String wxUserId, Integer state) {
if (null == type || null == relSkillId || null == robotId || null == wxUserId){
throw new BizException(BizException.PARAM_IS_NULL.getCode(),"type为空或者relSkillId为空");
}
......@@ -714,16 +740,35 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
if (1 == type){
//读书计划 确认某个读书计划
taskSubscribeBiz.subscribeTask(wxUserId,null,relSkillId,robotId);
if (null == state){
taskSubscribeBiz.subscribeTask(wxUserId,null,relSkillId,robotId);
}else {
if (1 == state){
taskSubscribeBiz.subscribeTask(wxUserId,null,relSkillId,robotId);
}else if (2 == state){
taskSubscribeBiz.unSubscribeTask(wxUserId,null,relSkillId);
}
}
}else if (2 == type){
pcloudGroupActivityBiz.processGroup(wxUserId,robotId,Long.valueOf(relSkillId.toString()));
pcloudSkillBiz.sendResource(id,wxUserId,robotId,relSkillId);
}else if (3 == type){
pcloudSkillBiz.sendResource(id,wxUserId,robotId,relSkillId);
}
//修改pcloud_sub_remind 未订阅提醒表状态
pcloudSubRemindBiz.updateSubState(relSkillId,type,wxUserId,id);
return skillFuseReply;
//修改pcloud_skill_record 状态值
if (2 == type || 3 == type){
state = 1;
}else if (1 == type){
if (null == state){
state = 1;
}
}
if(2 == type || 3 == type){
pcloudSkillRecordDao.updateState4ResourceAndActivity(wxUserId,robotId,id,state);
}
//修改pcloud_sub_remind 未订阅提醒表状态
pcloudSubRemindBiz.updateSubState(relSkillId,type,wxUserId,id);
return skillFuseReply;
}
@ParamLog("填充列表")
......
......@@ -43,4 +43,10 @@ public class RobotSkillDetail {
private String replyContent;
private Integer state;
private String wechatUserId;
private String robotId;
private Integer resourceCount;
}
......@@ -118,7 +118,7 @@ public interface SelfRobotKeywordFacade {
@ApiOperation(value = "确认任务", httpMethod = "GET")
@GetMapping("confirmSkill")
ResponseDto<?> confirmSkill(Integer id,Integer type,Integer relSkillId, String robotId, String wxUserId);
ResponseDto<?> confirmSkill(Integer id,Integer type,Integer relSkillId, String robotId, String wxUserId,Integer state);
@ApiOperation(value = "", httpMethod = "GET")
......
......@@ -177,9 +177,10 @@ public class SelfRobotKeywordFacadeImpl implements SelfRobotKeywordFacade {
@Override
@GetMapping("confirmSkill")
public ResponseDto<?> confirmSkill(@RequestParam Integer id,@RequestParam Integer type,@RequestParam Integer relSkillId, @RequestParam String robotId, @RequestParam String wxUserId) {
public ResponseDto<?> confirmSkill(@RequestParam Integer id,@RequestParam Integer type,@RequestParam Integer relSkillId,
@RequestParam String robotId, @RequestParam String wxUserId,@RequestParam(value = "state",required = false) Integer state) {
return new ResponseDto<>(selfRobotKeywordBiz.confirmSkill(id,type,relSkillId, robotId, wxUserId));
return new ResponseDto<>(selfRobotKeywordBiz.confirmSkill(id,type,relSkillId, robotId, wxUserId,state));
}
......
package com.pcloud.book.personal.biz;
import com.pcloud.book.personal.dto.PcloudLabelGroupDto;
import com.pcloud.book.personal.dto.PcloudUserLabelDto;
import com.pcloud.book.personal.entity.PcloudUserLabel;
import java.util.List;
public interface PcloudUserLabelBiz {
List<PcloudUserLabelDto> getPcloudUserLabelList(String wechatUserId);
void addPcloudUserLabel(List<PcloudUserLabel> pcloudUserLabels, Long wechatUserId);
void deletePcloudUserLabel(Integer id);
List<PcloudLabelGroupDto> getPcloudLabelGroup();
void batchDeletePcloudUserLabel(List<Integer> ids);
}
package com.pcloud.book.personal.biz;
import com.pcloud.book.keywords.entity.RobotSkillDetail;
import com.pcloud.common.page.PageBeanNew;
public interface PersonalBiz {
PageBeanNew<RobotSkillDetail> getSKillRecordPage(Integer skillType, String wxUserId, Integer currentPage, Integer numPerPage);
}
package com.pcloud.book.personal.biz;
import com.pcloud.book.personal.dto.PersonalMedalRecordDto;
import com.pcloud.book.personal.entity.PersonalMedal;
import com.pcloud.book.personal.entity.PersonalMedalRecord;
import com.pcloud.book.personal.enums.StarReceiveTypeEnum;
import java.util.List;
public interface PersonalMedalBiz {
List<PersonalMedal> getBaseMedalList();
List<PersonalMedalRecordDto> getUserMedalList(Long wechatUserId);
void loginReceiveStar(Long wechatUserId);
Integer getReceiveStarCount(Long wechatUserId);
void updateMedalShowed(Long medalRecordId);
void receiveStar(Long wechatUserId, StarReceiveTypeEnum starReceiveTypeEnum);
String shareMedal(Long medalId, Long wechatUserId,String robotWxId);
}
package com.pcloud.book.personal.biz.impl;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.consumer.reader.ReaderConsr;
import com.pcloud.book.personal.biz.PcloudUserLabelBiz;
import com.pcloud.book.personal.biz.PersonalMedalBiz;
import com.pcloud.book.personal.check.PersonalCheck;
import com.pcloud.book.personal.dto.PcloudLabelGroupDto;
import com.pcloud.book.personal.enums.StarReceiveTypeEnum;
import com.pcloud.book.personal.mapper.PcloudLabelMapper;
import com.pcloud.book.personal.mapper.PcloudUserLabelMapper;
import com.pcloud.book.personal.dto.PcloudUserLabelDto;
import com.pcloud.book.personal.entity.PcloudUserLabel;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.string.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
@Service("pcloudUserLabelBiz")
public class PcloudUserLabelBizImpl implements PcloudUserLabelBiz {
@Autowired
private PcloudUserLabelMapper pcloudUserLabelMapper;
@Autowired
private PersonalCheck personalCheck;
@Autowired
private PcloudLabelMapper pcloudLabelMapper;
@Autowired
private PersonalMedalBiz personalMedalBiz;
@Autowired
private ReaderConsr readerConsr;
@Override
@ParamLog("获取用户的标签列表")
public List<PcloudUserLabelDto> getPcloudUserLabelList(String wxUsrerId) {
if (StringUtil.isEmpty(wxUsrerId)){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"wxUsrerId为空");
}
return pcloudUserLabelMapper.getPcloudUserLabelList(wxUsrerId);
}
@Override
@ParamLog("新增用户的标签列表")
public void addPcloudUserLabel(List<PcloudUserLabel> pcloudUserLabels, Long wechatUserId) {
if (ListUtils.isEmpty(pcloudUserLabels)){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"pcloudUserLabels为空!");
}
pcloudUserLabels.stream().forEach(e ->{
personalCheck.checkUserLabel(e);
});
String wxUserId = pcloudUserLabels.get(0).getWxUserId();
//Long wechatUserId = readerConsr.getWechatUserId(pcloudUserLabel.getWxUserId(),null);
List<PcloudUserLabelDto> pcloudUserLabelDtos = this.getPcloudUserLabelList(wxUserId);
List<Integer> labelIdList = pcloudUserLabels.stream().map(e -> e.getPcloudLabelId()).collect(Collectors.toList());
if (!ListUtils.isEmpty(pcloudUserLabelDtos)){
List<Integer> labelIds = pcloudUserLabelDtos.stream().map(e -> e.getPcloudLabelId()).collect(Collectors.toList());
if (labelIds.retainAll(labelIdList)){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"标签已存在!");
}
}
if (ListUtils.isEmpty(pcloudUserLabelDtos) && null != wechatUserId){
personalMedalBiz.receiveStar(wechatUserId, StarReceiveTypeEnum.LIKE);
}
pcloudUserLabelMapper.batchInsert(pcloudUserLabels);
}
@Override
@ParamLog("删除用户的标签列表")
public void deletePcloudUserLabel(Integer id) {
if (null != id){
pcloudUserLabelMapper.deleteByPrimaryKey(id);
}
}
@Override
public List<PcloudLabelGroupDto> getPcloudLabelGroup() {
return pcloudLabelMapper.getPcloudLabelGroup();
}
@Override
public void batchDeletePcloudUserLabel(List<Integer> ids) {
if (!ListUtils.isEmpty(ids)){
pcloudUserLabelMapper.batchDeletePcloudUserLabel(ids);
}
}
}
package com.pcloud.book.personal.biz.impl;
import com.pcloud.book.keywords.entity.RobotSkillDetail;
import com.pcloud.book.personal.biz.PersonalBiz;
import com.pcloud.book.personal.check.PersonalCheck;
import com.pcloud.book.personal.dao.PcloudSkillRecordDao;
import com.pcloud.book.timecontrol.biz.TaskSubscribeBiz;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.string.StringUtilParent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service("personalBiz")
public class PersonalBizImpl implements PersonalBiz {
@Autowired
private PersonalCheck personalCheck;
@Autowired
private PcloudSkillRecordDao pcloudSkillRecordDao;
@Override
public PageBeanNew<RobotSkillDetail> getSKillRecordPage(Integer skillType, String wxUserId, Integer currentPage, Integer numPerPage) {
personalCheck.checkParam4SkillList(skillType,wxUserId,numPerPage,currentPage);
PageBeanNew<RobotSkillDetail> robotSkillDetailPageBeanNew = new PageBeanNew<>();
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("skillType",skillType);
paramMap.put("wxUserId",wxUserId);
if (1 == skillType){
robotSkillDetailPageBeanNew = pcloudSkillRecordDao.listPageNew(new PageParam(currentPage,numPerPage),
paramMap,"getSKillRecordPage4Task");
}else if (2 == skillType){
//共读活动
robotSkillDetailPageBeanNew = pcloudSkillRecordDao.listPageNew(new PageParam(currentPage,numPerPage),
paramMap,"getSKillRecordPage4Activity");
}else if (3 == skillType){
// 配套资源
robotSkillDetailPageBeanNew = pcloudSkillRecordDao.listPageNew(new PageParam(currentPage,numPerPage),
paramMap,"getSKillRecordPage4Resource");
}
if (null != robotSkillDetailPageBeanNew && !ListUtils.isEmpty(robotSkillDetailPageBeanNew.getRecordList())){
handIntroduce(robotSkillDetailPageBeanNew.getRecordList());
}
return robotSkillDetailPageBeanNew;
}
private void handIntroduce(List<RobotSkillDetail> recordList) {
recordList.stream().forEach(e ->{
String filterStr = StringUtilParent.replaceHtml(e.getRelSkillIntroduce());
e.setCutRelSkillIntroduce(filterStr);
});
}
}
package com.pcloud.book.personal.biz.impl;
import com.google.common.collect.Lists;
import com.pcloud.book.consumer.reader.ReaderConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.pcloudkeyword.biz.PcloudRobotBiz;
import com.pcloud.book.pcloudkeyword.entity.PcloudRobot;
import com.pcloud.book.personal.biz.PersonalMedalBiz;
import com.pcloud.book.personal.constants.MedalContants;
import com.pcloud.book.personal.dao.PersonalMedalDao;
import com.pcloud.book.personal.dao.PersonalMedalRecordDao;
import com.pcloud.book.personal.dao.PersonalStarRecordDao;
import com.pcloud.book.personal.dto.PersonalMedalRecordDto;
import com.pcloud.book.personal.entity.PersonalMedal;
import com.pcloud.book.personal.entity.PersonalMedalRecord;
import com.pcloud.book.personal.entity.PersonalStarRecord;
import com.pcloud.book.personal.enums.StarReceiveTypeEnum;
import com.pcloud.book.util.common.YesOrNoEnums;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.utils.DateUtils;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.facade.shareimage.dto.HtmlDto;
import com.pcloud.facade.shareimage.facade.Htm2ImgService;
import com.pcloud.readercenter.wechat.entity.WechatUser;
import com.pcloud.wechatgroup.group.dto.GroupRobotDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
@Slf4j
@Service("personalMedalBiz")
public class PersonalMedalBizImpl implements PersonalMedalBiz {
@Autowired
private PersonalMedalDao personalMedalDao;
@Autowired
private PersonalMedalRecordDao personalMedalRecordDao;
@Autowired
private PersonalStarRecordDao personalStarRecordDao;
@Autowired
private ReaderConsr readerConsr;
@Autowired
private PcloudRobotBiz pcloudRobotBiz;
@Autowired
private Htm2ImgService htm2ImgService;
@Override
@ParamLog("获取基础勋章数据")
public List<PersonalMedal> getBaseMedalList() {
List<PersonalMedal> baseMedalList = personalMedalDao.getBaseMedalList();
if(ListUtils.isEmpty(baseMedalList)){
throw new BizException(BizException.DB_LIST_IS_NULL.getCode(),"未查询到勋章数据");
}
return baseMedalList;
}
@Override
@ParamLog("获取用户已获得勋章数据")
public List<PersonalMedalRecordDto> getUserMedalList(Long wechatUserId) {
List<PersonalMedalRecordDto> userMedalList = personalMedalRecordDao.getUserMedalList(wechatUserId);
if(ListUtils.isEmpty(userMedalList)){
return Lists.newArrayList();
}
return userMedalList;
}
@Override
@ParamLog("登录奖励星星")
@Transactional(rollbackFor = Exception.class)
public void loginReceiveStar(Long wechatUserId) {
Date date = new Date();
String receiveDate = DateUtils.getShortDateStr(date);
// 查询用户今天是否领取过
Integer count = personalStarRecordDao.hasReceive(wechatUserId, receiveDate, StarReceiveTypeEnum.LOGIN.key);
if(count != null && count > 0){
return;
}
PersonalStarRecord personalStarRecord = new PersonalStarRecord();
personalStarRecord.setWechatUserId(wechatUserId);
personalStarRecord.setStarCount(MedalContants.LOGIN_RECEIVE_STAR_COUNT);
personalStarRecord.setType(StarReceiveTypeEnum.LOGIN.key);
personalStarRecord.setReceiveDate(receiveDate);
personalStarRecord.setCreateTime(date);
// 如果没领取,则增加
personalStarRecordDao.insert(personalStarRecord);
// 尝试自动领取勋章
autoReceiveMedal(wechatUserId);
}
@ParamLog("尝试自动领取勋章")
public void autoReceiveMedal(Long wechatUserId){
// 获取用户的星星数
Integer starCount = personalStarRecordDao.getReceiveStarCount(wechatUserId);
// 查询当前数量的星星可以领取的勋章(过滤掉已领取的)
List<Long> medalIds = personalMedalDao.getReceivingMedal(wechatUserId, starCount);
if(ListUtils.isEmpty(medalIds)){
return;
}
// 插入可以领取的记录
PersonalMedalRecord medalRecord;
for (Long medalId : medalIds){
medalRecord = new PersonalMedalRecord();
medalRecord.setMedalId(medalId);
medalRecord.setWechatUserId(wechatUserId);
medalRecord.setHasShow(YesOrNoEnums.YES.getValue());
// 插入领取记录
personalMedalRecordDao.insert(medalRecord);
}
}
@Override
@ParamLog("用户已领取的星星数量")
public Integer getReceiveStarCount(Long wechatUserId) {
if(wechatUserId == null || wechatUserId == 0){
throw new BizException(BizException.PARAM_IS_NULL.getCode(),"wechatUserId 不能为空");
}
return personalStarRecordDao.getReceiveStarCount(wechatUserId);
}
@Override
@ParamLog("更新勋章为已展示")
public void updateMedalShowed(Long medalRecordId){
PersonalMedalRecord medalRecord = new PersonalMedalRecord();
medalRecord.setId(medalRecordId);
medalRecord.setHasShow(YesOrNoEnums.NO.getValue());
personalMedalRecordDao.update(medalRecord);
}
@Override
@ParamLog("完善基础资料、喜欢的频道领取星星")
@Transactional(rollbackFor = Exception.class)
public void receiveStar(Long wechatUserId, StarReceiveTypeEnum starReceiveTypeEnum){
if(!starReceiveTypeEnum.key.equals(StarReceiveTypeEnum.BASE_INFO.key) && !starReceiveTypeEnum.key.equals(StarReceiveTypeEnum.LIKE.key)){
log.info("错误的【StarReceiveTypeEnum】类型:" + starReceiveTypeEnum.toString());
return;
}
// 查询用户是否领取过
Integer count = personalStarRecordDao.hasReceive(wechatUserId, null, starReceiveTypeEnum.key);
if(count != null && count > 0){
return;
}
Date date = new Date();
String receiveDate = DateUtils.getShortDateStr(date);
Integer starCount = starReceiveTypeEnum.key.equals(StarReceiveTypeEnum.BASE_INFO.key) ? MedalContants.BASE_INFO_RECEIVE_STAR_COUNT : MedalContants.LIKE_RECEIVE_STAR_COUNT;
PersonalStarRecord personalStarRecord = new PersonalStarRecord();
personalStarRecord.setWechatUserId(wechatUserId);
personalStarRecord.setStarCount(starCount);
personalStarRecord.setType(starReceiveTypeEnum.key);
personalStarRecord.setReceiveDate(receiveDate);
personalStarRecord.setCreateTime(date);
// 如果没领取,则增加
personalStarRecordDao.insert4Type(personalStarRecord);
// 尝试自动领取勋章
autoReceiveMedal(wechatUserId);
}
@Override
@ParamLog("分享")
public String shareMedal(Long medalId, Long wechatUserId, String robotWxId) {
// 获取用户基本信息
WechatUser wechatUser = readerConsr.getWechatUser(wechatUserId);
// 获取小号信息
PcloudRobot pcloudRobot = pcloudRobotBiz.getPcloudRobotByWxId(robotWxId);
// 获取勋章信息
PersonalMedal medal = personalMedalDao.getById(medalId);
if(wechatUser == null){
throw new BizException(BizException.DB_DML_FAIL.getCode(), "未找到用户信息");
}
if(pcloudRobot == null){
throw new BizException(BizException.DB_DML_FAIL.getCode(), "未找到小号信息");
}
if(medal == null){
throw new BizException(BizException.DB_DML_FAIL.getCode(), "未找到勋章信息");
}
// 调用图片生成
String html = buildMedalHtml(medal, wechatUser, pcloudRobot);
HtmlDto htmlDto=new HtmlDto();
htmlDto.setHeight(1206);
htmlDto.setWidth(750);
htmlDto.setHtmlCode(html);
htmlDto.setSnapshot(new Long(System.currentTimeMillis()).toString());
return ResponseHandleUtil.parseResponse(htm2ImgService.toJPGByChrome(htmlDto),String.class);
}
private String buildMedalHtml(PersonalMedal medal, WechatUser wechatUser, PcloudRobot pcloudRobot) {
return "<!DOCTYPE html>\n" +
"<html lang=\"en\">\n" +
"<head>\n" +
" <meta charset=\"GBK\">\n" +
" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n" +
" <title>Document</title>\n" +
"</head>\n" +
"<style>\n" +
" *{\n" +
" margin: 0;\n" +
" padding: 0;\n" +
" }\n" +
" .headBg {\n" +
" position: absolute;\n" +
" top: 150px;\n" +
" height: 686px;\n" +
" left: 50%;\n" +
" margin-left: -300px;\n" +
" }\n" +
" .Img {\n" +
" width: 750px;\n" +
" height: 100vh;\n" +
" }\n" +
" .header {\n" +
" height: 370px;\n" +
" color: white;\n" +
" position: relative;\n" +
" overflow: hidden;\n" +
" \n" +
" }\n" +
" .goBack {\n" +
" margin-top: 30px;\n" +
" margin-left: 30px;\n" +
" width: 100px;\n" +
" }\n" +
" .sharInfoBox {\n" +
" position: absolute;\n" +
" top: 119px;\n" +
" left: 50%;\n" +
" margin-left: -375px;\n" +
" }\n" +
" .Img {\n" +
" width: 690px;\n" +
" height: 972px;\n" +
" }\n" +
" .head {\n" +
" position: absolute;\n" +
" height: 150px;\n" +
" width: 150px;\n" +
" top: 75px;\n" +
" left: 50%;\n" +
" margin-left: -75px;\n" +
" border-radius: 50%!important;\n" +
" background-image: url(https://file.5rs.me/oss/uploadfe/png/5cda5008f3334ea44a50092afaae3a28.png);\n" +
" background-size: auto;\n" +
" background-repeat: no-repeat;\n" +
" background-position: center;\n" +
" }\n" +
" h1 {\n" +
" position: relative;\n" +
" top: 229px;\n" +
" /* color: #1b7ec4; */\n" +
" color: black;\n" +
" font-size: 44px;\n" +
" margin: 0 auto;\n" +
" text-align: center;\n" +
" }\n" +
" .medal {\n" +
" z-index: 2;\n" +
" position: absolute;\n" +
" top: 296px;\n" +
" height: 330px;\n" +
" width: 330px;\n" +
" border-radius: 50%;\n" +
" left: 50%;\n" +
" margin-left: -165px;\n" +
" }\n" +
" .medalLevel {\n" +
" font-size: 36px;\n" +
" color: #333;\n" +
" position: relative;\n" +
" top: 586px;\n" +
" margin: 0 auto;\n" +
" text-align: center;\n" +
" }\n" +
" .medalDesc {\n" +
" font-size: 28px;\n" +
" color: #333;\n" +
" position: absolute;\n" +
" top: 720px;\n" +
" left: 50%;\n" +
" margin-left: -209px;\n" +
" }\n" +
" .qrcode {\n" +
" width: 183px;\n" +
" height: 183px;\n" +
" position: absolute;\n" +
" top: 890px;\n" +
" left: 9%;\n" +
" }\n" +
" .ShareInfo {\n" +
" position: relative;\n" +
" height: 100vh;\n" +
" background-image: linear-gradient(126deg, #3a82ee 0%, #3a67ee 50%, #3a4bee 100%), linear-gradient(#3a82ee, #3a82ee);\n" +
" background-blend-mode: normal, normal;\n" +
" }\n" +
" .longPress {\n" +
" width: 358px;\n" +
" height: 183px;\n" +
" position: absolute;\n" +
" top: 840px;\n" +
" left: 40%;\n" +
" }\n" +
" p {\n" +
" font-size: 24px;\n" +
" color: #666;\n" +
" margin-top: 12px;\n" +
" }\n" +
" .shadows {\n" +
" top: 120px;\n" +
" position: absolute;\n" +
" width: 286px;\n" +
" height: 15px;\n" +
" background-color: #fbbf1f;\n" +
" }\n" +
" .shadow {\n" +
" top: 68px;\n" +
" position: absolute;\n" +
" width: 286px;\n" +
" height: 15px;\n" +
" background-color: #fbbf1f;\n" +
" }\n" +
" h3 {\n" +
" margin-top: 44px;\n" +
" position: relative;\n" +
" font-size: 32px;\n" +
" color: #1a2235;\n" +
" font-weight: bold;\n" +
" z-index: 2;\n" +
" }\n" +
" .double{\n" +
" margin-top: 7px;\n" +
" }\n" +
"</style>\n"+
"<body>\n" +
" <div class=\"ShareInfo\">\n" +
" <div class=\"sharInfoBox\">\n" +
" <!-- 大背景图照片 -->\n" +
" <img src='https://file.5rs.me/oss/uploadfe/png/10c414d99b869c8bc8c2d064de60cfe4.png' />\n" +
" </div>\n" +
" <img src='"+ wechatUser.getWechatUserHeadurl() +"' class=\"head\" />\n" +
" <h1>"+ wechatUser.getWechatUserNickname() +"</h1>\n" +
" <img src='"+ medal.getBigImgUrl() +"'class=\"medal\" />\n" +
" <h2 class=\"medalLevel\">" + medal.getMedalName() +"</h2>\n" +
" <p class=\"medalDesc\">"+ (medal.getContent() == null ? "" : medal.getContent()) +"</p>\n" +
" <img src='"+ pcloudRobot.getQrcodeUrl() +"' class=\"qrcode\" />\n" +
" <div class=\"longPress\">\n" +
" <div class=\"shadow\"></div>\n" +
" <div class=\"shadows\"></div>\n" +
" <h3>学习太累快加小睿</h3>\n" +
" <h3 class=\"double\">学习效率马上翻倍</h3>\n" +
" <p>长按转发,把我介绍给你的朋友吧或长按名片保存到手机</p>\n" +
" </div>\n" +
" <img src='https://file.5rs.me/oss/uploadfe/png/e4bfffe37f09e74b73db4a6b467635ad.png' class=\"headBg\" />\n" +
" </div>\n" +
"</body>\n" +
"</html>";
}
}
package com.pcloud.book.personal.check;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.keywords.enums.ReplyTypeEnum;
import com.pcloud.book.pcloudkeyword.dao.PcloudKeywordNameDao;
import com.pcloud.book.pcloudkeyword.entity.PcloudKeyword;
import com.pcloud.book.pcloudkeyword.entity.PcloudKeywordName;
import com.pcloud.book.pcloudkeyword.entity.PcloudKeywordReply;
import com.pcloud.book.pcloudkeyword.entity.PcloudNotKeyword;
import com.pcloud.book.personal.entity.PcloudUserLabel;
import com.pcloud.book.reading.check.ParamCheck;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.ParamChecker;
import com.pcloud.common.utils.string.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.stream.Collectors;
@Component("personalCheck")
public class PersonalCheck {
public void checkParam4SkillList(Integer skillType, String wxUserId, Integer numPerPage, Integer currentPage) {
if (null == skillType){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"技能为空!");
}
if (StringUtil.isEmpty(wxUserId)){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"wxUserId为空!");
}
ParamChecker.checkPageParamIsAbsent(currentPage,numPerPage,"分页参数错误");
}
public void checkUserLabel(PcloudUserLabel pcloudUserLabel) {
if (null == pcloudUserLabel){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"pcloudUserLabel为空!");
}
if (StringUtil.isEmpty(pcloudUserLabel.getWxUserId())){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"wxUserId为空!");
}
if (null == pcloudUserLabel.getPcloudLabelId()){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"PcloudLabelId为空!");
}
}
}
package com.pcloud.book.personal.constants;
public class MedalContants {
// 每日登录领取星星数
public static final Integer LOGIN_RECEIVE_STAR_COUNT = 1;
// 完善基本信息领取星星数
public static final Integer BASE_INFO_RECEIVE_STAR_COUNT = 15;
// 完善我喜欢的频道领取星星数
public static final Integer LIKE_RECEIVE_STAR_COUNT = 15;
}
package com.pcloud.book.personal.dao;
import com.pcloud.book.personal.entity.PcloudSkillRecord;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
public interface PcloudSkillRecordDao extends BaseDao<PcloudSkillRecord> {
int deleteByPrimaryKey(Integer id);
int insertSelective(PcloudSkillRecord record);
PcloudSkillRecord selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(PcloudSkillRecord record);
int updateByPrimaryKey(PcloudSkillRecord record);
PcloudSkillRecord getBySkillIdAndWxId(Integer skillId, String wxUserId);
void updateState4ResourceAndActivity(String wxUserId, String robotId, Integer id, Integer state);
void batchUpdateState4ResourceAndActivity(String wxUserId, List<Long> skillIds, Integer i);
}
\ No newline at end of file
package com.pcloud.book.personal.dao;
import com.pcloud.book.personal.entity.PersonalMedal;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
public interface PersonalMedalDao extends BaseDao<PersonalMedal> {
List<PersonalMedal> getBaseMedalList();
List<Long> getReceivingMedal(Long wechatUserId, Integer starCount);
}
package com.pcloud.book.personal.dao;
import com.pcloud.book.personal.dto.PersonalMedalRecordDto;
import com.pcloud.book.personal.entity.PersonalMedalRecord;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
public interface PersonalMedalRecordDao extends BaseDao<PersonalMedalRecord> {
List<PersonalMedalRecordDto> getUserMedalList(Long wechatUserId);
}
package com.pcloud.book.personal.dao;
import com.pcloud.book.personal.entity.PersonalStarRecord;
import com.pcloud.common.core.dao.BaseDao;
public interface PersonalStarRecordDao extends BaseDao<PersonalStarRecord> {
Integer hasReceive(Long wechatUserId, String receiveDate, Integer type);
Integer getReceiveStarCount(Long wechatUserId);
Integer insert4Type(PersonalStarRecord personalStarRecord);
}
package com.pcloud.book.personal.dao.impl;
import com.pcloud.book.personal.dao.PcloudSkillRecordDao;
import com.pcloud.book.personal.entity.PcloudSkillRecord;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Repository("pcloudSkillRecordDao")
public class PcloudSkillRecordDaoImpl extends BaseDaoImpl<PcloudSkillRecord> implements PcloudSkillRecordDao {
@Override
public int deleteByPrimaryKey(Integer id) {
return super.sqlSessionTemplate.delete(this.getStatement("deleteByPrimaryKey"),id);
}
@Override
public int insertSelective(PcloudSkillRecord record) {
return super.sqlSessionTemplate.insert(this.getStatement("insertSelective"),record);
}
@Override
public PcloudSkillRecord selectByPrimaryKey(Integer id) {
return super.getSessionTemplate().selectOne(this.getStatement("selectByPrimaryKey"),id);
}
@Override
public int updateByPrimaryKeySelective(PcloudSkillRecord record) {
return super.getSessionTemplate().update(this.getStatement("updateByPrimaryKeySelective"),record);
}
@Override
public int updateByPrimaryKey(PcloudSkillRecord record) {
return super.getSessionTemplate().update(this.getStatement("updateByPrimaryKey"),record);
}
@Override
public PcloudSkillRecord getBySkillIdAndWxId(Integer skillId, String wxUserId) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("skillId",skillId);
paramMap.put("wxUserId",wxUserId);
return super.getSessionTemplate().selectOne(this.getStatement("getBySkillIdAndWxId"),paramMap);
}
@Override
public void updateState4ResourceAndActivity(String wxUserId, String robotId, Integer id, Integer state) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("skillId",id);
paramMap.put("wxUserId",wxUserId);
paramMap.put("state",state);
super.getSessionTemplate().update(this.getStatement("updateState4ResourceAndActivity"),paramMap);
}
@Override
public void batchUpdateState4ResourceAndActivity(String wxUserId, List<Long> skillIds, Integer state) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("skillIds",skillIds);
paramMap.put("wxUserId",wxUserId);
paramMap.put("state",state);
super.getSessionTemplate().update(this.getStatement("batchUpdateState4ResourceAndActivity"),paramMap);
}
}
package com.pcloud.book.personal.dao.impl;
import com.google.common.collect.Maps;
import com.pcloud.book.personal.dao.PersonalMedalDao;
import com.pcloud.book.personal.entity.PersonalMedal;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.List;
@Repository("personalMedalDao")
public class PersonalMedalDaoImpl extends BaseDaoImpl<PersonalMedal> implements PersonalMedalDao {
@Override
public List<PersonalMedal> getBaseMedalList() {
return super.getSqlSession().selectList(getStatement("getBaseMedalList"));
}
@Override
public List<Long> getReceivingMedal(Long wechatUserId, Integer starCount) {
HashMap<String, Object> map = Maps.newHashMap();
map.put("wechatUserId", wechatUserId);
map.put("starCount",starCount);
return super.getSqlSession().selectList(getStatement("getReceivingMedal"), map);
}
}
package com.pcloud.book.personal.dao.impl;
import com.pcloud.book.personal.dao.PersonalMedalRecordDao;
import com.pcloud.book.personal.dto.PersonalMedalRecordDto;
import com.pcloud.book.personal.entity.PersonalMedalRecord;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository("personalMedalRecordDao")
public class PersonalMedalRecordDaoImpl extends BaseDaoImpl<PersonalMedalRecord> implements PersonalMedalRecordDao {
@Override
public List<PersonalMedalRecordDto> getUserMedalList(Long wechatUserId) {
return super.getSqlSession().selectList(getStatement("getUserMedalList"), wechatUserId);
}
}
package com.pcloud.book.personal.dao.impl;
import com.google.common.collect.Maps;
import com.pcloud.book.personal.dao.PersonalStarRecordDao;
import com.pcloud.book.personal.entity.PersonalStarRecord;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
import java.util.HashMap;
@Repository("personalStarRecordDao")
public class PersonalStarRecordDaoImpl extends BaseDaoImpl<PersonalStarRecord> implements PersonalStarRecordDao {
@Override
public Integer hasReceive(Long wechatUserId, String receiveDate, Integer type) {
HashMap<String, Object> map = Maps.newHashMap();
map.put("wechatUserId", wechatUserId);
map.put("receiveDate",receiveDate);
map.put("type",type);
return super.getSqlSession().selectOne(getStatement("hasReceive"), map);
}
@Override
public Integer getReceiveStarCount(Long wechatUserId) {
HashMap<String, Object> map = Maps.newHashMap();
map.put("wechatUserId", wechatUserId);
return super.getSqlSession().selectOne(getStatement("getReceiveStarCount"), map);
}
@Override
public Integer insert4Type(PersonalStarRecord personalStarRecord) {
return super.getSqlSession().insert(getStatement("insert4Type"), personalStarRecord);
}
}
package com.pcloud.book.personal.dto;
import com.pcloud.wechatgroup.base.dto.BaseDTO;
import java.util.List;
import lombok.Data;
@Data
public class PcloudLabelGroupDto extends BaseDTO {
private Integer pcloudLabelType;
private String pcloudLabelTypeName;
private List<PcloudUserLabelDto> pcloudUserLabelDtos;
}
package com.pcloud.book.personal.dto;
import com.pcloud.facade.tradecenter.dto.PayRightNowDto;
import com.pcloud.wechatgroup.base.dto.BaseDTO;
import lombok.Data;
@Data
public class PcloudSkillRecordDto extends BaseDTO {
private Integer id;
private Integer skillId;
private String wxUserId;
private String robotWxId;
//状态值 0 未获取 1 已获取
private Integer state;
private Integer skillType;
//技能状态值 0 未删除 1 已删除
private Integer skillIsDelete;
}
package com.pcloud.book.personal.dto;
import com.pcloud.wechatgroup.base.dto.BaseDTO;
import java.util.Date;
import lombok.Data;
@Data
public class PcloudUserLabelDto extends BaseDTO {
private Integer id;
private String wxUserId;
private Integer pcloudLabelId;
private String pcloudLabelName;
private Integer pcloudLabelType;
private Date createTime;
private Date updateTime;
}
package com.pcloud.book.personal.dto;
import com.pcloud.common.entity.BaseEntity;
import lombok.Data;
@Data
public class PersonalMedalRecordDto{
private Long id;
private Long medalId;
private Long wechatUserId;
private Integer hasShow;
private String bigImgUrl;
}
\ No newline at end of file
package com.pcloud.book.personal.entity;
import java.util.Date;
public class PcloudLabel {
private Integer id;
private String labelName;
private Byte labelType;
private Date createTime;
private Date updateTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getLabelName() {
return labelName;
}
public void setLabelName(String labelName) {
this.labelName = labelName == null ? null : labelName.trim();
}
public Byte getLabelType() {
return labelType;
}
public void setLabelType(Byte labelType) {
this.labelType = labelType;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
\ No newline at end of file
package com.pcloud.book.personal.entity;
import com.pcloud.common.entity.BaseEntity;
import java.util.Date;
import lombok.Data;
@Data
public class PcloudSkillRecord extends BaseEntity {
private Integer skillId;
private String wxUserId;
private String robotWxId;
//状态值 0 未获取 1 已获取
private Integer state;
private Integer skillType;
//技能状态值 0 未删除 1 已删除
private Integer skillIsDelete;
}
\ No newline at end of file
package com.pcloud.book.personal.entity;
import java.util.Date;
import lombok.Data;
@Data
public class PcloudUserLabel {
private Integer id;
private String wxUserId;
private Long wechatUserId;
private Integer pcloudLabelId;
private Date createTime;
private Date updateTime;
}
\ No newline at end of file
package com.pcloud.book.personal.entity;
import com.pcloud.common.entity.BaseEntity;
import lombok.Data;
import java.util.Date;
@Data
public class PersonalMedal extends BaseEntity {
private Long id;
private String greyImgUrl;
private String lightImgUrl;
private String bigImgUrl;
private String medalName;
private String content;
private Integer starLimitCount;
}
\ No newline at end of file
package com.pcloud.book.personal.entity;
import com.pcloud.common.entity.BaseEntity;
import lombok.Data;
@Data
public class PersonalMedalRecord extends BaseEntity {
private Long id;
private Long medalId;
private Long wechatUserId;
private Integer hasShow;
}
\ No newline at end of file
package com.pcloud.book.personal.entity;
import com.pcloud.common.entity.BaseEntity;
import lombok.Data;
@Data
public class PersonalStarRecord extends BaseEntity {
private Long id;
private Long wechatUserId;
private Integer starCount;
private Integer type;
private String receiveDate;
}
\ No newline at end of file
package com.pcloud.book.personal.enums;
public enum StarReceiveTypeEnum {
LOGIN(1, "每日登录领取"),
BASE_INFO(2,"完善基础信息"),
LIKE(3,"喜欢的频道");
public final Integer key;
public final String desc;
StarReceiveTypeEnum(Integer key, String desc){
this.key = key;
this.desc = desc;
}
}
package com.pcloud.book.personal.facade;
import com.pcloud.book.personal.biz.PcloudUserLabelBiz;
import com.pcloud.book.personal.dto.PcloudLabelGroupDto;
import com.pcloud.book.personal.dto.PcloudUserLabelDto;
import com.pcloud.book.personal.entity.PcloudUserLabel;
import com.pcloud.common.dto.ResponseDto;
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.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.List;
import io.swagger.annotations.Api;
@Api("个人中心标签")
@RestController("pcloudUserLabelFacede")
@RequestMapping("pcloudUserLabel")
public class PcloudUserLabelFacede {
@Autowired
private PcloudUserLabelBiz pcloudUserLabelBiz;
@RequestMapping(value = "getPcloudUserLabelList",method = RequestMethod.GET)
public ResponseDto<List<PcloudUserLabelDto>> getPcloudUserLabelList(@RequestParam String wxUserId){
return new ResponseDto<List<PcloudUserLabelDto>>(pcloudUserLabelBiz.getPcloudUserLabelList(wxUserId));
}
@RequestMapping(value = "addPcloudUserLabel",method = RequestMethod.POST)
public ResponseDto<?> addPcloudUserLabel(@CookieValue("userInfo") String userInfo, @RequestBody List<PcloudUserLabel> pcloudUserLabels){
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
pcloudUserLabelBiz.addPcloudUserLabel(pcloudUserLabels,wechatUserId);
return new ResponseDto<>();
}
@RequestMapping(value = "deletePcloudUserLabel",method = RequestMethod.GET)
public ResponseDto<?> deletePcloudUserLabel(@RequestParam("id") Integer id){
pcloudUserLabelBiz.deletePcloudUserLabel(id);
return new ResponseDto<>();
}
@RequestMapping(value = "batchDeletePcloudUserLabel",method = RequestMethod.POST)
public ResponseDto<?> batchDeletePcloudUserLabel(@RequestBody List<Integer> ids){
pcloudUserLabelBiz.batchDeletePcloudUserLabel(ids);
return new ResponseDto<>();
}
@RequestMapping(value = "getPcloudLabelGroup",method = RequestMethod.GET)
public ResponseDto<List<PcloudLabelGroupDto>> getPcloudLabelGroup(){
return new ResponseDto<List<PcloudLabelGroupDto>>(pcloudUserLabelBiz.getPcloudLabelGroup());
}
}
package com.pcloud.book.personal.facade;
import com.pcloud.book.keywords.entity.RobotSkillDetail;
import com.pcloud.book.personal.biz.PersonalBiz;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.page.PageBeanNew;
import org.apache.ibatis.annotations.Param;
import org.elasticsearch.common.recycler.Recycler.V;
import org.springframework.beans.factory.annotation.Autowired;
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 javax.xml.ws.soap.Addressing;
import io.swagger.annotations.Api;
@Api("个人中心")
@RestController("personalFacade")
@RequestMapping("personal")
public class PersonalFacade {
@Autowired
private PersonalBiz personalBiz;
@RequestMapping(value = "getSKillRecordPage",method = RequestMethod.GET)
public ResponseDto<PageBeanNew<RobotSkillDetail>> getSKillRecordPage(@RequestParam("type") Integer skillType, @RequestParam String wxUserId,
@Param("currentPage") Integer currentPage, @Param("numPerPage") Integer numPerPage){
PageBeanNew<RobotSkillDetail> pageBeanNew = personalBiz.getSKillRecordPage(skillType,wxUserId,currentPage,numPerPage);
return new ResponseDto<>(pageBeanNew);
}
}
package com.pcloud.book.personal.facade;
import com.pcloud.book.personal.biz.PersonalMedalBiz;
import com.pcloud.book.personal.enums.StarReceiveTypeEnum;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.NumberUtil;
import com.pcloud.common.utils.cookie.Cookie;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@Api("个人中心勋章")
@RestController("personalMedalFacade")
@RequestMapping("personalMedal")
public class PersonalMedalFacade {
@Autowired
private PersonalMedalBiz personalMedalBiz;
@ApiOperation("勋章基础展示列表")
@GetMapping("getBaseMedalList")
public ResponseDto<?> getBaseMedalList() throws PermissionException {
return new ResponseDto<>(personalMedalBiz.getBaseMedalList());
}
@ApiOperation("获取用户已获得的勋章")
@GetMapping("getUserMedalList")
public ResponseDto<?> getUserMedalList(@CookieValue("userInfo") String userInfo) throws PermissionException {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
if(!NumberUtil.isNumber(wechatUserId)){
throw new BizException(BizException.PARAM_IS_NULL.getCode(), "wechatUserId 不能为空");
}
return new ResponseDto<>(personalMedalBiz.getUserMedalList(wechatUserId));
}
@ApiOperation("登录获取勋章")
@GetMapping("loginReceiveStar")
public ResponseDto<?> loginReceiveStar(@CookieValue("userInfo") String userInfo) throws PermissionException {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
if(!NumberUtil.isNumber(wechatUserId)){
throw new BizException(BizException.PARAM_IS_NULL.getCode(), "wechatUserId 不能为空");
}
personalMedalBiz.loginReceiveStar(wechatUserId);
return new ResponseDto<>();
}
@ApiOperation("用户已领取的星星数量")
@GetMapping("getReceiveStarCount")
public ResponseDto<?> getReceiveStarCount(@CookieValue("userInfo") String userInfo){
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
if(!NumberUtil.isNumber(wechatUserId)){
throw new BizException(BizException.PARAM_IS_NULL.getCode(), "wechatUserId 不能为空");
}
return new ResponseDto<>(personalMedalBiz.getReceiveStarCount(wechatUserId));
}
@ApiOperation("更新勋章为已展示")
@GetMapping("updateMedalShowed")
public ResponseDto<?> updateMedalShowed(@CookieValue("userInfo") String userInfo,@RequestParam Long medalRecordId){
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
if(!NumberUtil.isNumber(wechatUserId)){
throw new BizException(BizException.PARAM_IS_NULL.getCode(), "wechatUserId 不能为空");
}
personalMedalBiz.updateMedalShowed(medalRecordId);
return new ResponseDto<>();
}
@ApiOperation("领取基础资料星星")
@GetMapping("receiveStar4BaseInfo")
public ResponseDto<?> receiveStar4BaseInfo(@CookieValue("userInfo") String userInfo){
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
if(!NumberUtil.isNumber(wechatUserId)){
throw new BizException(BizException.PARAM_IS_NULL.getCode(), "wechatUserId 不能为空");
}
personalMedalBiz.receiveStar(wechatUserId, StarReceiveTypeEnum.BASE_INFO);
return new ResponseDto<>();
}
@ApiOperation("分享")
@GetMapping("shareMedal")
public ResponseDto<?> shareMedal(@CookieValue("userInfo") String userInfo,@RequestParam Long medalId, @RequestParam String robotWxId){
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
if(!NumberUtil.isNumber(wechatUserId)){
throw new BizException(BizException.PARAM_IS_NULL.getCode(), "wechatUserId 不能为空");
}
return new ResponseDto<>(personalMedalBiz.shareMedal(medalId, wechatUserId, robotWxId));
}
}
package com.pcloud.book.personal.mapper;
import com.pcloud.book.personal.dto.PcloudLabelGroupDto;
import com.pcloud.book.personal.entity.PcloudLabel;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public interface PcloudLabelMapper {
int deleteByPrimaryKey(Integer id);
int insert(PcloudLabel record);
int insertSelective(PcloudLabel record);
PcloudLabel selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(PcloudLabel record);
int updateByPrimaryKey(PcloudLabel record);
List<PcloudLabelGroupDto> getPcloudLabelGroup();
}
\ No newline at end of file
package com.pcloud.book.personal.mapper;
import com.pcloud.book.personal.dto.PcloudUserLabelDto;
import com.pcloud.book.personal.entity.PcloudUserLabel;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public interface PcloudUserLabelMapper {
int deleteByPrimaryKey(Integer id);
int insert(PcloudUserLabel record);
int insertSelective(PcloudUserLabel record);
PcloudUserLabel selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(PcloudUserLabel record);
int updateByPrimaryKey(PcloudUserLabel record);
List<PcloudUserLabelDto> getPcloudUserLabelList(String wechatUserId);
void batchInsert(List<PcloudUserLabel> pcloudUserLabels);
void batchDeletePcloudUserLabel(List<Integer> ids);
}
\ No newline at end of file
......@@ -26,4 +26,6 @@ public interface PcloudSkillDao extends BaseDao<PcloudSkill> {
Integer getMaxSeqNum();
PcloudSkill getByRelId(Integer relSkillId, Integer type);
List<Long> getListByRelId(Integer taskId);
}
......@@ -72,4 +72,9 @@ public class PcloudSkillDaoImpl extends BaseDaoImpl<PcloudSkill> implements Pclo
paramMap.put("type", type);
return getSqlSession().selectOne(getStatement("getByRelId"), paramMap);
}
@Override
public List<Long> getListByRelId(Integer taskId) {
return super.getSqlSession().selectList(getStatement("getListByRelId"), taskId);
}
}
package com.pcloud.book.timecontrol.biz;
import com.pcloud.book.keywords.entity.RobotSkillDetail;
import com.pcloud.book.timecontrol.entity.TimeControlTaskSubscribe;
import com.pcloud.common.page.PageBeanNew;
/**
* @date: 2020年01月31日 20:11
......
......@@ -8,8 +8,10 @@ import com.pcloud.book.consumer.content.ResourceConsr;
import com.pcloud.book.consumer.resource.ProductConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.group.biz.WeixinQrcodeBiz;
import com.pcloud.book.keywords.entity.RobotSkillDetail;
import com.pcloud.book.keywords.enums.ReplyTypeEnum;
import com.pcloud.book.pcloudkeyword.set.PcloudRobotSet;
import com.pcloud.book.personal.dao.PcloudSkillRecordDao;
import com.pcloud.book.skill.biz.PcloudSubRemindBiz;
import com.pcloud.book.skill.dao.PcloudSkillDao;
import com.pcloud.book.skill.dao.PcloudSubReplyDao;
......@@ -36,6 +38,7 @@ import com.pcloud.book.util.common.YesOrNoEnums;
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.page.PageBeanNew;
import com.pcloud.common.utils.DateUtils;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.httpclient.UrlUtils;
......@@ -117,10 +120,18 @@ public class TaskSubscribeBizImpl implements TaskSubscribeBiz {
private String wechatGroupLinkPrefix;
@Autowired
private PcloudRobotSet pcloudRobotSet;
@Autowired
private PcloudSkillRecordDao pcloudSkillRecordDao;
@Override
@ParamLog("任务订阅")
public void subscribeTask(String wxUserId, Long bookId, Integer taskId, String robotWxId) {
//更新技能记录列表状态
List<Long> skillIds = pcloudSkillDao.getListByRelId(taskId);
if (!ListUtils.isEmpty(skillIds)){
pcloudSkillRecordDao.batchUpdateState4ResourceAndActivity(wxUserId,skillIds,1);
}
TimeControlTask timeControlTask = taskMapper.selectByPrimaryKey(taskId);
if (null == timeControlTask) {
return;
......@@ -245,6 +256,11 @@ public class TaskSubscribeBizImpl implements TaskSubscribeBiz {
@Override
@ParamLog("取消订阅")
public void unSubscribeTask(String wxUserId, Long bookId, Integer taskId) {
//更新技能记录列表状态
List<Long> skillIds = pcloudSkillDao.getListByRelId(taskId);
if (!ListUtils.isEmpty(skillIds)){
pcloudSkillRecordDao.batchUpdateState4ResourceAndActivity(wxUserId,skillIds,2);
}
TimeControlTask timeControlTask = taskMapper.selectByPrimaryKey(taskId);
if (null == timeControlTask) {
return;
......
......@@ -32,10 +32,15 @@ public interface TimeControlTaskSubscribeMapper {
void completedTaskById(Integer subscribeId);
<<<<<<< HEAD
/**
* 查询参与人数和完成人数
* @param taskId
* @return
*/
TaskProgressDTO getSubscribeStatics(@Param("taskId") Integer taskId);
=======
//查询用户
Integer getTaskRecordCount(String wxUserId);
>>>>>>> 个人中心
}
......@@ -5,6 +5,8 @@ server:
eureka:
instance:
status-page-url-path: /book/v1.0/swagger-ui.html
# client:
# register-with-eureka: false #禁止自己当做服务注册
spring:
application:
......
......@@ -5,7 +5,7 @@
<generatorConfiguration>
<classPathEntry
location="D:\maven\repository\mysql\mysql-connector-java\5.1.40\mysql-connector-java-5.1.40.jar"/>
location="C:\work\repository\mysql\mysql-connector-java\5.1.44\mysql-connector-java-5.1.44.jar"/>
<context id="my" targetRuntime="MyBatis3">
<commentGenerator>
<property name="suppressDate" value="false"/>
......@@ -17,26 +17,32 @@
password="LGSC2016.lgsc"/>
<javaModelGenerator targetPackage="com.pcloud.book"
targetProject="D:\project\RAYS\pcloud-book\pcloud-service-book\src\main\java">
targetProject="C:\project\rays\个人中心\pcloud-book\pcloud-service-book\src\main\java">
<property name="enableSubPackages" value="true"/>
<property name="trimStrings" value="true"/>
</javaModelGenerator>
<sqlMapGenerator targetPackage="com.pcloud.book"
targetProject="D:\project\RAYS\pcloud-book\pcloud-service-book\src\main\java">
targetProject="C:\project\rays\个人中心\pcloud-book\pcloud-service-book\src\main\java">
<property name="enableSubPackages" value="true"/>
</sqlMapGenerator>
<javaClientGenerator targetPackage="com.pcloud.book"
targetProject="D:\project\RAYS\pcloud-book\pcloud-service-book\src\main\java" type="XMLMAPPER">
targetProject="C:\project\rays\个人中心\pcloud-book\pcloud-service-book\src\main\java" type="XMLMAPPER">
<property name="enableSubPackages" value="true"/>
</javaClientGenerator>
<table tableName="book_group_collection" domainObjectName="BookGroupCollection"
<!-- <table tableName="book_group_collection" domainObjectName="BookGroupCollection"
enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false">
</table>-->
<table tableName="pcloud_label" domainObjectName="pcloudLabel"
enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false">
</table>
</context>
</generatorConfiguration>
\ No newline at end of file
</generatorConfiguration>
<?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.personal.dao.impl.PersonalMedalDaoImpl" >
<resultMap id="BaseResultMap" type="com.pcloud.book.personal.entity.PersonalMedal" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="grey_img_url" property="greyImgUrl" jdbcType="VARCHAR" />
<result column="light_img_url" property="lightImgUrl" jdbcType="VARCHAR" />
<result column="big_img_url" property="bigImgUrl" jdbcType="VARCHAR" />
<result column="medal_name" property="medalName" jdbcType="VARCHAR" />
<result column="content" property="content" jdbcType="VARCHAR" />
<result column="star_limit_count" property="starLimitCount" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
id, grey_img_url, light_img_url, big_img_url, medal_name, content, star_limit_count, create_time, update_time
</sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
<include refid="Base_Column_List" />
from personal_medal
where id = #{id,jdbcType=BIGINT}
</select>
<select id="getBaseMedalList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from personal_medal
</select>
<select id="getReceivingMedal" resultType="long" parameterType="map">
SELECT id FROM personal_medal a
WHERE star_limit_count <![CDATA[ <= ]]> #{starCount}
AND NOT EXISTS(SELECT 1 FROM personal_medal_record WHERE medal_id = a.id AND wechat_user_id = #{wechatUserId})
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from personal_medal
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.pcloud.book.personal.entity.PersonalMedal" >
insert into personal_medal (id, grey_img_url, light_img_url, big_img_url, medal_name, content,
star_limit_count, create_time, update_time
)
values (#{id,jdbcType=BIGINT}, #{greyImgUrl,jdbcType=VARCHAR},#{lightImgUrl,jdbcType=VARCHAR},#{bigImgUrl,jdbcType=VARCHAR}, #{medalName,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR},
#{starLimitCount,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
</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.personal.dao.impl.PersonalMedalRecordDaoImpl" >
<resultMap id="BaseResultMap" type="com.pcloud.book.personal.entity.PersonalMedalRecord" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="medal_id" property="medalId" jdbcType="BIGINT" />
<result column="wechat_user_id" property="wechatUserId" jdbcType="BIGINT" />
<result column="has_show" property="hasShow" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
id, medal_id, wechat_user_id, has_show, create_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
<include refid="Base_Column_List" />
from personal_medal_record
where id = #{id,jdbcType=BIGINT}
</select>
<select id="getUserMedalList" resultType="com.pcloud.book.personal.dto.PersonalMedalRecordDto" parameterType="java.lang.Long">
select
a.id,
a.medal_id medalId,
a.wechat_user_id wechatUserId,
a.has_show hasShow,
b.big_img_url bigImgUrl
from personal_medal_record a,personal_medal b
where a.medal_id = b.id AND a.wechat_user_id = #{wechatUserId,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from personal_medal_record
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.pcloud.book.personal.entity.PersonalMedalRecord" useGeneratedKeys="true" keyProperty="id" >
INSERT INTO personal_medal_record (medal_id, wechat_user_id, has_show, create_time)
SELECT #{medalId,jdbcType=BIGINT}, #{wechatUserId,jdbcType=BIGINT},#{hasShow,jdbcType=INTEGER}, NOW()
WHERE NOT EXISTS(SELECT 1 FROM personal_medal_record WHERE medal_id = #{medalId,jdbcType=BIGINT} AND wechat_user_id = #{wechatUserId,jdbcType=BIGINT})
</insert>
<update id="update" parameterType="com.pcloud.book.personal.entity.PersonalMedalRecord" >
update personal_medal_record
<set >
<if test="medalId != null" >
medal_id = #{medalId,jdbcType=BIGINT},
</if>
<if test="hasShow != null" >
has_show = #{hasShow,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.pcloud.book.personal.entity.PersonalMedalRecord" >
update personal_medal_record
set medal_id = #{medalId,jdbcType=BIGINT},
wechat_user_id = #{wechatUserId,jdbcType=BIGINT},
has_show = #{hasShow,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</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.personal.dao.impl.PersonalStarRecordDaoImpl" >
<resultMap id="BaseResultMap" type="com.pcloud.book.personal.entity.PersonalStarRecord" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="wechat_user_id" property="wechatUserId" jdbcType="BIGINT" />
<result column="star_count" property="starCount" jdbcType="INTEGER" />
<result column="type" property="type" jdbcType="INTEGER" />
<result column="receive_date" property="receiveDate" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
id, wechat_user_id, star_count, type, receive_date, create_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
<include refid="Base_Column_List" />
from personal_star_record
where id = #{id,jdbcType=BIGINT}
</select>
<select id="hasReceive" parameterType="map" resultType="int">
SELECT COUNT(1) FROM `personal_star_record`
WHERE wechat_user_id = #{wechatUserId,jdbcType=BIGINT}
<if test="receiveDate != null">
AND receive_date = #{receiveDate,jdbcType=VARCHAR}
</if>
AND type = #{type,jdbcType=INTEGER}
LIMIT 1;
</select>
<select id="getReceiveStarCount" parameterType="map" resultType="int">
SELECT IFNULL(SUM(star_count),0) FROM `personal_star_record`
WHERE wechat_user_id = #{wechatUserId,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from personal_star_record
where id = #{id,jdbcType=BIGINT}
</delete>
<!-- 如果当前没有领取,则新增 -->
<insert id="insert" parameterType="com.pcloud.book.personal.entity.PersonalStarRecord" useGeneratedKeys="true" keyProperty="id" >
INSERT INTO personal_star_record (wechat_user_id, star_count, type, receive_date, create_time)
SELECT #{wechatUserId,jdbcType=BIGINT}, #{starCount,jdbcType=INTEGER},
#{type,jdbcType=INTEGER}, #{receiveDate,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}
WHERE NOT EXISTS(SELECT 1 FROM `personal_star_record` WHERE wechat_user_id = #{wechatUserId,jdbcType=BIGINT} AND receive_date = #{receiveDate,jdbcType=VARCHAR})
</insert>
<insert id="insert4Type" parameterType="com.pcloud.book.personal.entity.PersonalStarRecord" useGeneratedKeys="true" keyProperty="id">
INSERT INTO personal_star_record (wechat_user_id, star_count, type, receive_date, create_time)
SELECT #{wechatUserId,jdbcType=BIGINT}, #{starCount,jdbcType=INTEGER},
#{type,jdbcType=INTEGER}, #{receiveDate,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}
WHERE NOT EXISTS(SELECT 1 FROM `personal_star_record` WHERE wechat_user_id = #{wechatUserId,jdbcType=BIGINT} AND type = #{type,jdbcType=INTEGER})
</insert>
<update id="update" parameterType="com.pcloud.book.personal.entity.PersonalStarRecord" >
update personal_star_record
<set >
<if test="starCount != null" >
star_count = #{starCount,jdbcType=INTEGER},
</if>
<if test="type != null" >
type = #{type,jdbcType=INTEGER},
</if>
<if test="receiveDate != null" >
receive_date = #{receiveDate,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.pcloud.book.personal.entity.PersonalStarRecord" >
update personal_star_record
set wechat_user_id = #{wechatUserId,jdbcType=BIGINT},
star_count = #{starCount,jdbcType=INTEGER},
type = #{type,jdbcType=INTEGER},
receive_date = #{receiveDate,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</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.personal.mapper.PcloudLabelMapper" >
<resultMap id="BaseResultMap" type="com.pcloud.book.personal.entity.PcloudLabel" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="label_name" property="labelName" jdbcType="VARCHAR" />
<result column="label_type" property="labelType" jdbcType="TINYINT" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
</resultMap>
<resultMap id="labelGroupMap" type="com.pcloud.book.personal.dto.PcloudLabelGroupDto">
<result column="pcloud_label_type" property="pcloudLabelType" jdbcType="TINYINT"/>
<result column="pcloud_label_type_name" property="pcloudLabelTypeName" jdbcType="VARCHAR"/>
<collection property="pcloudUserLabelDtos" ofType="com.pcloud.book.personal.dto.PcloudUserLabelDto">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="label_name" property="pcloudLabelName" jdbcType="VARCHAR"/>
<result column="label_type" property="pcloudLabelType" jdbcType="TINYINT"/>
</collection>
</resultMap>
<sql id="Base_Column_List" >
id, label_name, label_type, create_time, update_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from pcloud_label
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from pcloud_label
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.pcloud.book.personal.entity.PcloudLabel" >
insert into pcloud_label (id, label_name, label_type,
create_time, update_time)
values (#{id,jdbcType=INTEGER}, #{labelName,jdbcType=VARCHAR}, #{labelType,jdbcType=TINYINT},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.pcloud.book.personal.entity.PcloudLabel" >
insert into pcloud_label
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="labelName != null" >
label_name,
</if>
<if test="labelType != null" >
label_type,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="updateTime != null" >
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="labelName != null" >
#{labelName,jdbcType=VARCHAR},
</if>
<if test="labelType != null" >
#{labelType,jdbcType=TINYINT},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.personal.entity.PcloudLabel" >
update pcloud_label
<set >
<if test="labelName != null" >
label_name = #{labelName,jdbcType=VARCHAR},
</if>
<if test="labelType != null" >
label_type = #{labelType,jdbcType=TINYINT},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.pcloud.book.personal.entity.PcloudLabel" >
update pcloud_label
set label_name = #{labelName,jdbcType=VARCHAR},
label_type = #{labelType,jdbcType=TINYINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="getPcloudLabelGroup" resultMap="labelGroupMap">
select
plt.pcloud_label_type,
plt.pcloud_label_type_name,
pl.label_name,
pl.id,
pl.label_type
from
pcloud_label pl
left join pcloud_label_type plt
on pl.label_type = plt.pcloud_label_type
</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.personal.dao.impl.PcloudSkillRecordDaoImpl" >
<resultMap id="BaseResultMap" type="com.pcloud.book.personal.entity.PcloudSkillRecord" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="skill_id" property="skillId" jdbcType="INTEGER" />
<result column="wx_user_id" property="wxUserId" jdbcType="VARCHAR" />
<result column="robot_wx_id" property="robotWxId" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="state" property="state" jdbcType="TINYINT" />
<result column="skill_type" property="skillType" jdbcType="TINYINT" />
<result column="skill_is_delete" property="skillIsDelete" jdbcType="TINYINT" />
</resultMap>
<resultMap id="SkillDetailMap" type="com.pcloud.book.keywords.entity.RobotSkillDetail">
<id column="id" property="id" jdbcType="BIGINT"/>
<association property="resourceCount" column="id" select="com.pcloud.book.skill.dao.impl.PcloudSubReplyDaoImpl.getResourceCountBySkillId"/>
</resultMap>
<sql id="Base_Column_List" >
id, skill_id, wx_user_id, robot_wx_id, create_time, update_time, state, skill_type,skill_is_delete
</sql>
<sql id="Base_Column_List_psr" >
psr.id, psr.skill_id, psr.wx_user_id, psr.robot_wx_id, psr.create_time, psr.update_time, psr.state, psr.skill_type, psr.skill_is_delete
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from pcloud_skill_record
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from pcloud_skill_record
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.pcloud.book.personal.entity.PcloudSkillRecord" >
insert into pcloud_skill_record (id, skill_id, wx_user_id,
robot_wx_id, create_time, update_time,
state, skill_type)
values (#{id,jdbcType=INTEGER}, #{skillId,jdbcType=INTEGER}, #{wxUserId,jdbcType=VARCHAR},
#{robotWxId,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{state,jdbcType=TINYINT}, #{skillType,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.pcloud.book.personal.entity.PcloudSkillRecord" >
insert into pcloud_skill_record
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="skillId != null" >
skill_id,
</if>
<if test="wxUserId != null" >
wx_user_id,
</if>
<if test="robotWxId != null" >
robot_wx_id,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="updateTime != null" >
update_time,
</if>
<if test="state != null" >
state,
</if>
<if test="skillType != null" >
skill_type,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="skillId != null" >
#{skillId,jdbcType=INTEGER},
</if>
<if test="wxUserId != null" >
#{wxUserId,jdbcType=VARCHAR},
</if>
<if test="robotWxId != null" >
#{robotWxId,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="state != null" >
#{state,jdbcType=TINYINT},
</if>
<if test="skillType != null" >
#{skillType,jdbcType=TINYINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.personal.entity.PcloudSkillRecord" >
update pcloud_skill_record
<set >
<if test="skillId != null" >
skill_id = #{skillId,jdbcType=INTEGER},
</if>
<if test="wxUserId != null" >
wx_user_id = #{wxUserId,jdbcType=VARCHAR},
</if>
<if test="robotWxId != null" >
robot_wx_id = #{robotWxId,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="state != null" >
state = #{state,jdbcType=TINYINT},
</if>
<if test="skillType != null" >
skill_type = #{skillType,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.pcloud.book.personal.entity.PcloudSkillRecord" >
update pcloud_skill_record
set skill_id = #{skillId,jdbcType=INTEGER},
wx_user_id = #{wxUserId,jdbcType=VARCHAR},
robot_wx_id = #{robotWxId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
state = #{state,jdbcType=TINYINT},
skill_type = #{skillType,jdbcType=TINYINT}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="getBySkillIdAndWxId" parameterType="map" resultMap="BaseResultMap">
select
<include refid="Base_Column_List_psr"/>
from
pcloud_skill_record psr
left join pcloud_skill ps
on psr.skill_id = ps.id
where
skill_is_delete = 0
and ps.id = #{skillId}
and psr.wx_user_id = #{wxUserId}
</select>
<update id="updateState4ResourceAndActivity" parameterType="map">
update
pcloud_skill_record
set
state = #{state}
where
skill_id = #{skillId}
and wx_user_id = #{wxUserId}
and skill_is_delete = 0
</update>
<update id="batchUpdateState4ResourceAndActivity" parameterType="map">
update
pcloud_skill_record
set
state = #{state}
where
skill_id in
<foreach collection="skillIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
and wx_user_id = #{wxUserId}
and skill_is_delete = 0
</update>
<select id="getSKillRecordPage4Activity" parameterType="map" resultType="com.pcloud.book.keywords.entity.RobotSkillDetail">
select
ps.id id,
ps.rel_skill_id relSkillId,
ps.skill_type type,
pga.name relSkillName,
pga.description relSkillIntroduce,
psr.wx_user_id wechatUserId,
psr.robot_wx_id robotId,
psr.state state
from
pcloud_skill_record psr
left join pcloud_skill ps
on psr.skill_id = ps.id
left join pcloud_group_activity pga
on ps.rel_skill_id = pga.id
where
psr.wx_user_id = #{wxUserId}
and
psr.skill_type = #{skillType}
order by psr.update_time desc
</select>
<select id="getSKillRecordPage4Resource" parameterType="map" resultMap="SkillDetailMap">
select
ps.id id,
ps.rel_skill_id relSkillId,
ps.skill_type type,
pr.name relSkillName,
pr.description relSkillIntroduce,
psr.wx_user_id wechatUserId,
psr.robot_wx_id robotId,
psr.state state
from
pcloud_skill_record psr
left join pcloud_skill ps
on psr.skill_id = ps.id
left join pcloud_resource pr
on ps.rel_skill_id = pr.id
where
psr.wx_user_id = #{wxUserId}
and
psr.skill_type = #{skillType}
order by psr.update_time desc
</select>
<select id="getSKillRecordPage4Task" parameterType="map" resultType="com.pcloud.book.keywords.entity.RobotSkillDetail">
select
ps.id id,
ps.rel_skill_id relSkillId,
ps.skill_type type,
tct.task_name relSkillName,
tct.task_introduce relSkillIntroduce,
psr.wx_user_id wechatUserId,
psr.robot_wx_id robotId,
psr.state state
from
pcloud_skill_record psr
left join pcloud_skill ps
on psr.skill_id = ps.id
left join time_control_task tct
on ps.rel_skill_id = tct.task_id
where
psr.wx_user_id = #{wxUserId}
and
psr.skill_type = #{skillType}
order by psr.update_time desc
</select>
</mapper>
\ No newline at end of file
......@@ -215,4 +215,14 @@
ORDER BY
s.seq_num
</select>
<select id="getListByRelId" parameterType="integer" resultType="Long">
select
id
from
pcloud_skill
where
rel_skill_id = #{taskId}
</select>
</mapper>
\ No newline at end of file
......@@ -128,4 +128,11 @@
from pcloud_sub_reply
where pcloud_skill_id=#{skillId} and sub_type = #{subType}
</select>
<select id="getResourceCountBySkillId" parameterType="integer" resultType="integer">
select
count(id)
from pcloud_sub_reply
where pcloud_skill_id = #{_parameter}
</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.personal.mapper.PcloudUserLabelMapper" >
<resultMap id="BaseResultMap" type="com.pcloud.book.personal.entity.PcloudUserLabel" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="wx_user_id" property="wxUserId" jdbcType="VARCHAR" />
<result column="pcloud_label_id" property="pcloudLabelId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
id, wx_user_id, pcloud_label_id, create_time,
update_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from pcloud_user_label
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from pcloud_user_label
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.pcloud.book.personal.entity.PcloudUserLabel" >
insert into pcloud_user_label (id, wx_user_id, pcloud_label_id, create_time,
update_time)
values (#{id,jdbcType=INTEGER}, #{wxUserId,jdbcType=VARCHAR}, #{pcloudLabelId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.pcloud.book.personal.entity.PcloudUserLabel" >
insert into pcloud_user_label
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="wxUserId != null" >
wx_user_id,
</if>
<if test="pcloudLabelId != null" >
pcloud_label_id,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="updateTime != null" >
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="wxUserId != null" >
#{wxUserId,jdbcType=VARCHAR},
</if>
<if test="pcloudLabelId != null" >
#{pcloudLabelId,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.personal.entity.PcloudUserLabel" >
update pcloud_user_label
<set >
<if test="wxUserId != null" >
wx_user_id = #{wxUserId,jdbcType=VARCHAR},
</if>
<if test="pcloudLabelId != null" >
pcloud_label_id = #{pcloudLabelId,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.pcloud.book.personal.entity.PcloudUserLabel" >
update pcloud_user_label
set wx_user_id = #{wxUserId,jdbcType=VARCHAR},
pcloud_label_id = #{pcloudLabelId,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="getPcloudUserLabelList" parameterType="string" resultType="com.pcloud.book.personal.dto.PcloudUserLabelDto">
select
pul.id,
pul.wx_user_id wxUserId,
pul.pcloud_label_id pcloudLabelId,
pl.label_name pcloudLabelName,
pl.label_type pcloudLabelType
from
pcloud_user_label pul
left join pcloud_label pl
on pul.pcloud_label_id = pl.id
where
pul.wx_user_id = #{wechatUserId}
order by pul.create_time desc
</select>
<insert id="batchInsert" parameterType="com.pcloud.book.personal.entity.PcloudUserLabel">
INSERT INTO pcloud_user_label (
wx_user_id,
pcloud_label_id,
create_time,
update_time
) VALUES
<foreach collection="list" item="item" index="index" separator="," >
(
#{item.wxUserId},
#{item.pcloudLabelId},
now(),
now()
)
</foreach>
</insert>
<delete id="batchDeletePcloudUserLabel" parameterType="list">
delete
from
pcloud_user_label
where
id in
<foreach collection="list" item="item" index="index" open="(" close=")" separator="," >
#{item}
</foreach>
</delete>
</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