Commit f7d82401 by 裴大威

feat 拉群

parents b5c11382 3f86ad40
package com.pcloud.book.group.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/8/7 9:26
**/
@ApiModel("群使用情况模型")
public class GroupUseDTO implements Serializable {
@ApiModelProperty("已使用")
private Integer hasUsed;
@ApiModelProperty("未使用")
private Integer notUsed;
public Integer getHasUsed() {
return hasUsed;
}
public void setHasUsed(Integer hasUsed) {
this.hasUsed = hasUsed;
}
public Integer getNotUsed() {
return notUsed;
}
public void setNotUsed(Integer notUsed) {
this.notUsed = notUsed;
}
@Override
public String toString() {
return "GroupUseDTO{" +
"hasUsed=" + hasUsed +
", notUsed=" + notUsed +
'}';
}
}
package com.pcloud.book.group.dto;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/8/7 11:23
**/
public class LargeTempletDTO implements Serializable {
private static final long serialVersionUID = -5982946901202138966L;
@ApiModelProperty("大类")
private Integer largeTemplet;
@ApiModelProperty("名称")
private String name;
public Integer getLargeTemplet() {
return largeTemplet;
}
public void setLargeTemplet(Integer largeTemplet) {
this.largeTemplet = largeTemplet;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "LargeTempletDTO{" +
"largeTemplet=" + largeTemplet +
", name='" + name + '\'' +
'}';
}
}
...@@ -2,12 +2,11 @@ package com.pcloud.book.group.service; ...@@ -2,12 +2,11 @@ package com.pcloud.book.group.service;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.pcloud.book.group.dto.GroupUseDTO;
import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import com.pcloud.book.group.dto.BookGroupDTO; import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
...@@ -34,4 +33,15 @@ public interface BookGroupService { ...@@ -34,4 +33,15 @@ public interface BookGroupService {
@RequestMapping(value = "getBaseInfoBySceneId",method = RequestMethod.GET) @RequestMapping(value = "getBaseInfoBySceneId",method = RequestMethod.GET)
ResponseEntity<ResponseDto<BookGroupDTO>> getBaseInfoBySceneId(@RequestParam("sceneId")Long sceneId) throws BizException; ResponseEntity<ResponseDto<BookGroupDTO>> getBaseInfoBySceneId(@RequestParam("sceneId")Long sceneId) throws BizException;
@ApiOperation("获取暗号状态")
@GetMapping("/getCipherState")
ResponseEntity<ResponseDto<Integer>> getCipherState(@RequestParam("cipher")String cipher) throws BizException;
@ApiOperation("更新暗号状态为已使用")
@GetMapping("/updateCipherStateToUsed")
void updateCipherStateToUsed(@RequestParam("cipher")String cipher, @RequestParam("wxId")String wxId) throws BizException;
@ApiOperation("获取个人二维码方式群已使用和未使用数量")
@PostMapping("/getGroupUse")
ResponseEntity<ResponseDto<GroupUseDTO>> getGroupUse(@RequestBody List<String> altIds) throws BizException;
} }
...@@ -16,6 +16,8 @@ import com.pcloud.wechatgroup.message.service.MessageService; ...@@ -16,6 +16,8 @@ import com.pcloud.wechatgroup.message.service.MessageService;
import com.pcloud.wechatgroup.monitor.service.MonitorService; import com.pcloud.wechatgroup.monitor.service.MonitorService;
import com.pcloud.wechatgroup.selfrobot.service.SelfRobotService; import com.pcloud.wechatgroup.selfrobot.service.SelfRobotService;
import com.pcloud.wechatgroup.selfrobot.dto.SelfRobotDTO;
import com.pcloud.wechatgroup.selfrobot.service.SelfRobotService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -308,4 +310,15 @@ public class WechatGroupConsr { ...@@ -308,4 +310,15 @@ public class WechatGroupConsr {
} }
return map; return map;
} }
@ParamLog(value = "获取可用机器人")
public SelfRobotDTO getAvailableRobot(Long wechatUserId, Integer largeTemplet, Long classifyId) {
SelfRobotDTO selfRobotDTO = null;
try {
selfRobotDTO = ResponseHandleUtil.parseResponse(selfRobotService.getAvailableRobot(wechatUserId, largeTemplet, classifyId), SelfRobotDTO.class);
} catch (Exception e) {
log.error("获取可用机器人.[getAvailableRobot]:" + e.getMessage(), e);
}
return selfRobotDTO;
}
} }
package com.pcloud.book.group.biz; package com.pcloud.book.group.biz;
import com.pcloud.book.book.dto.BookDto; import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.group.dto.AppStatisticsDTO; import com.pcloud.book.group.dto.*;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.ClassifyKeywordDTO;
import com.pcloud.book.group.dto.QrcodeNameAndProIdDTO;
import com.pcloud.book.group.entity.BookGroup; import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.vo.StatisticVO; import com.pcloud.book.group.vo.StatisticVO;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
...@@ -245,4 +242,29 @@ public interface BookGroupBiz { ...@@ -245,4 +242,29 @@ public interface BookGroupBiz {
* 获取是否显示书名 * 获取是否显示书名
*/ */
Boolean getIsShowBookName(Long partyId); Boolean getIsShowBookName(Long partyId);
/**
* 根据分类id获取个人二维码信息
*/
OwnAltQrcodeInfoDTO getOwnAltQrcodeInfoDTOByClassifyId(Long wechatUserId, Long classifyId);
/**
* 获取暗号状态
*/
Integer getCipherState(String cipher);
/**
* 更新状态为已使用
*/
void updateCipherStateToUsed(String cipher, String wxId);
/**
* 获取个人二维码方式群已使用和未使用数量
*/
GroupUseDTO getGroupUse(List<String> altIds);
/**
* 获取所有的大类分类
*/
List<LargeTempletDTO> getAllLargTemplet();
} }
...@@ -113,6 +113,11 @@ public interface BookGroupClassifyBiz { ...@@ -113,6 +113,11 @@ public interface BookGroupClassifyBiz {
GroupQrcode4ClassifyVO getGroupQrcode4ClassifyWechat(Long classifyId, Long wechatUserId); GroupQrcode4ClassifyVO getGroupQrcode4ClassifyWechat(Long classifyId, Long wechatUserId);
/** /**
* 用户获取具体进群id
*/
String getWxGroupIdByClassifyIdAndWechatId(Long classifyId, Long wechatUserId);
/**
* @Author:lili * @Author:lili
* @Desr:获取编辑所有的分类 * @Desr:获取编辑所有的分类
* @Date:2019/4/30 15:33 * @Date:2019/4/30 15:33
......
package com.pcloud.book.group.biz.impl; package com.pcloud.book.group.biz.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;
import com.pcloud.appcenter.app.dto.AppDto; import com.pcloud.appcenter.app.dto.AppDto;
import com.pcloud.appcenter.base.dto.AppPriceCacheDTO; import com.pcloud.appcenter.base.dto.AppPriceCacheDTO;
import com.pcloud.appcenter.cache.service.AppPriceCacheService; import com.pcloud.appcenter.cache.service.AppPriceCacheService;
...@@ -17,18 +18,15 @@ import com.pcloud.book.consumer.resource.ProductConsr; ...@@ -17,18 +18,15 @@ import com.pcloud.book.consumer.resource.ProductConsr;
import com.pcloud.book.consumer.settlement.SettlementConsr; import com.pcloud.book.consumer.settlement.SettlementConsr;
import com.pcloud.book.consumer.trade.TradeConsr; import com.pcloud.book.consumer.trade.TradeConsr;
import com.pcloud.book.consumer.user.AdviserConsr; import com.pcloud.book.consumer.user.AdviserConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.group.biz.BookGroupBiz; import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.biz.BookGroupClassifyBiz; import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.dao.AppClickRecordDao; import com.pcloud.book.group.dao.*;
import com.pcloud.book.group.dao.AppTouchRecordDao; import com.pcloud.book.group.dto.*;
import com.pcloud.book.group.dao.BookGroupClassifyDao;
import com.pcloud.book.group.dao.BookGroupDao;
import com.pcloud.book.group.dto.AppStatisticsDTO;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.BookGroupStatisticDTO;
import com.pcloud.book.group.dto.ClassifyKeywordDTO;
import com.pcloud.book.group.dto.QrcodeNameAndProIdDTO;
import com.pcloud.book.group.entity.BookGroup; import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.entity.JoinGroupCipher;
import com.pcloud.book.group.entity.TempletRelevance;
import com.pcloud.book.group.enums.LargTempletEnum;
import com.pcloud.book.group.vo.StatisticVO; import com.pcloud.book.group.vo.StatisticVO;
import com.pcloud.book.keywords.dao.BookKeywordDao; import com.pcloud.book.keywords.dao.BookKeywordDao;
import com.pcloud.book.keywords.enums.ReplyTypeEnum; import com.pcloud.book.keywords.enums.ReplyTypeEnum;
...@@ -48,10 +46,7 @@ import com.pcloud.common.exceptions.BizException; ...@@ -48,10 +46,7 @@ import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBean; import com.pcloud.common.page.PageBean;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam; import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.DateUtils; import com.pcloud.common.utils.*;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.QrcodeUtils;
import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.common.utils.string.StringUtil; import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.common.utils.zip.CompressUtils; import com.pcloud.common.utils.zip.CompressUtils;
import com.pcloud.facade.tradecenter.dto.GroupMoneyDto; import com.pcloud.facade.tradecenter.dto.GroupMoneyDto;
...@@ -71,6 +66,7 @@ import com.pcloud.settlementcenter.record.service.SettlementService; ...@@ -71,6 +66,7 @@ import com.pcloud.settlementcenter.record.service.SettlementService;
import com.pcloud.videolesson.schedule.service.ScheduleService; import com.pcloud.videolesson.schedule.service.ScheduleService;
import com.pcloud.wechatgroup.group.service.GroupMemberService; import com.pcloud.wechatgroup.group.service.GroupMemberService;
import com.pcloud.wechatgroup.selfrobot.dto.SelfRobotDTO;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -154,6 +150,14 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -154,6 +150,14 @@ public class BookGroupBizImpl implements BookGroupBiz {
private TimeTableService timeTableService; private TimeTableService timeTableService;
@Autowired @Autowired
private AppPriceCacheService appPriceCacheService; private AppPriceCacheService appPriceCacheService;
@Autowired
private TempletRelevanceDao templetRelevanceDao;
@Autowired
private JoinGroupCipherDao joinGroupCipherDao;
@Autowired
private WechatGroupConsr wechatGroupConsr;
@Autowired
private WeixinQrcodeDao weixinQrcodeDao;
@Override @Override
...@@ -1058,4 +1062,116 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -1058,4 +1062,116 @@ public class BookGroupBizImpl implements BookGroupBiz {
return bookGroupDao.getIsShowBookName(partyId); return bookGroupDao.getIsShowBookName(partyId);
} }
@Transactional(rollbackFor = Exception.class)
@ParamLog("根据分类id获取个人二维码信息")
@Override
public OwnAltQrcodeInfoDTO getOwnAltQrcodeInfoDTOByClassifyId(Long wechatUserId, Long classifyId) {
OwnAltQrcodeInfoDTO ownAltQrcodeInfoDTO = new OwnAltQrcodeInfoDTO();
//根据分类id查询社群码信息
ClassifyDTO classifyDTO = bookGroupClassifyDao.getById(classifyId);
if (classifyDTO == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "没有该分类");
}
Long bookId = classifyDTO.getBookId();
Map<String, Object> paramMap = Maps.newHashMap();
paramMap.put("bookId", bookId);
paramMap.put("adviserId", classifyDTO.getCreateUser());
paramMap.put("channelId", classifyDTO.getChannelId());
BookDto bookDto = bookDao.getById(paramMap);
Long templetId = bookDto.getTempletId();
//根据分类id获取大类
TempletRelevance templetRelevance = templetRelevanceDao.getByTempletId(templetId);
LOGGER.info("根据分类id获取大类templetRelevance" + templetRelevance.toString());
Integer largeTemplet = templetRelevance.getLargeTemplet();
SelfRobotDTO selfRobotDTO = wechatGroupConsr.getAvailableRobot(wechatUserId, largeTemplet, classifyId);
if (selfRobotDTO == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "未找到机器人!");
}
ownAltQrcodeInfoDTO.setAltHeadUrl(selfRobotDTO.getHeadPic());
ownAltQrcodeInfoDTO.setAltId(selfRobotDTO.getWxId());
ownAltQrcodeInfoDTO.setAltNickName(selfRobotDTO.getNickName());
ownAltQrcodeInfoDTO.setAltQrcodeUrl(selfRobotDTO.getQrcodeUrl());
ownAltQrcodeInfoDTO.setAltHeadUrl(selfRobotDTO.getHeadPic());
//获取之前是否有没有使用的暗号
JoinGroupCipher joinGroupCipher = joinGroupCipherDao.getByCreateUser(wechatUserId, classifyId);
String cipher;
if (joinGroupCipher != null) {
cipher = joinGroupCipher.getCipher();
} else {
//新增暗号
cipher = UUIDUitl.generateShort();
//查重,如果有重复,再次生成
JoinGroupCipher joinGroupCipherHas = joinGroupCipherDao.getByCipher(cipher);
if (joinGroupCipherHas != null) {
cipher = UUIDUitl.generateShort();
}
JoinGroupCipher joinGroupCipherNew = new JoinGroupCipher();
joinGroupCipherNew.setCipher(cipher);
joinGroupCipherNew.setCreateUser(wechatUserId);
joinGroupCipherNew.setClassifyId(classifyId);
joinGroupCipherDao.insert(joinGroupCipherNew);
}
ownAltQrcodeInfoDTO.setCipher(cipher);
return ownAltQrcodeInfoDTO;
}
@ParamLog("获取暗号状态")
@Override
public Integer getCipherState(String cipher) {
Integer state;
if (StringUtil.isEmpty(cipher)) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数不能为空!");
}
JoinGroupCipher joinGroupCipher = joinGroupCipherDao.getByCipher(cipher);
if (joinGroupCipher == null) {
//暗号错误
state = 2;
} else if (joinGroupCipher.getHasUsed() != null && joinGroupCipher.getHasUsed()) {
//已使用
state = 1;
} else {
//未使用
state = 0;
}
return state;
}
@Transactional(rollbackFor = Exception.class)
@ParamLog("获取暗号状态为已使用")
@Override
public void updateCipherStateToUsed(String cipher, String wxId) {
if (StringUtil.isEmpty(cipher) || StringUtil.isEmpty(wxId)) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数不能为空!");
}
joinGroupCipherDao.updateCipherStateToUsed(cipher,wxId);
}
@ParamLog("获取个人二维码方式群已使用和未使用数量")
@Override
public GroupUseDTO getGroupUse(List<String> altIds) {
if (ListUtils.isEmpty(altIds)) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数不能为空!");
}
GroupUseDTO groupUseDTO = new GroupUseDTO();
Integer notUsed = weixinQrcodeDao.countByState(0, altIds);
Integer hasUsed = weixinQrcodeDao.countByState(1, altIds);
Integer full = weixinQrcodeDao.countByState(2, altIds);
groupUseDTO.setHasUsed(hasUsed + full);
groupUseDTO.setNotUsed(notUsed);
return groupUseDTO;
}
@ParamLog("获取所有的大类分类")
@Override
public List<LargeTempletDTO> getAllLargTemplet() {
List<LargeTempletDTO> list = new ArrayList<>();
for (LargTempletEnum largTempletEnum : LargTempletEnum.values()) {
LargeTempletDTO largeTempletDTO = new LargeTempletDTO();
largeTempletDTO.setLargeTemplet(largTempletEnum.code);
largeTempletDTO.setName(largTempletEnum.name);
list.add(largeTempletDTO);
}
return list;
}
} }
...@@ -511,6 +511,19 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz { ...@@ -511,6 +511,19 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
return groupQrcode4ClassifyVO; return groupQrcode4ClassifyVO;
} }
@Override
public String getWxGroupIdByClassifyIdAndWechatId(Long classifyId, Long wechatUserId) {
if(null == classifyId || null == wechatUserId) {
return null;
}
final GroupQrcode4ClassifyVO wechat = this.getGroupQrcode4ClassifyWechat(classifyId, wechatUserId);
if(null == wechat) {
return null;
}
final GroupQrcodeBaseInfoVO baseById = this.groupQrcodeBiz.getBaseById(wechat.getGroupQrcodeId());
return (null == baseById) ? null : baseById.getWeixinGroupId();
}
@ParamLog("获取备用二维码") @ParamLog("获取备用二维码")
private String getSpareQr(Long bookGroupId) { private String getSpareQr(Long bookGroupId) {
//获取备用二维码 //获取备用二维码
......
package com.pcloud.book.group.dao;
import com.pcloud.book.group.dto.JoinGroupCiperDTO;
import com.pcloud.book.group.entity.JoinGroupCipher;
import com.pcloud.common.core.dao.BaseDao;
public interface JoinGroupCipherDao extends BaseDao<JoinGroupCipher> {
JoinGroupCipher getByCreateUser(Long wechatUserId,Long classifyId);
JoinGroupCipher getByCipher(String cipher);
JoinGroupCiperDTO getDTOByCipher(String cipher);
void updateCipherStateToUsed(String cipher, String wxId);
}
package com.pcloud.book.group.dao;
import com.pcloud.book.group.entity.TempletRelevance;
import com.pcloud.common.core.dao.BaseDao;
public interface TempletRelevanceDao extends BaseDao<TempletRelevance> {
TempletRelevance getByTempletId(Long templetId);
}
...@@ -155,4 +155,9 @@ public interface WeixinQrcodeDao extends BaseDao<WeixinQrcode> { ...@@ -155,4 +155,9 @@ public interface WeixinQrcodeDao extends BaseDao<WeixinQrcode> {
Map<String, BookWxQrcodeDTO> listByWxGroupIds(List<String> wxGroupIds); Map<String, BookWxQrcodeDTO> listByWxGroupIds(List<String> wxGroupIds);
String getVirtualIp(Integer generation); String getVirtualIp(Integer generation);
/**
* 根据状态获取群数量
*/
Integer countByState(Integer state, List<String> altIds);
} }
package com.pcloud.book.group.dao.impl;
import com.pcloud.book.group.dao.JoinGroupCipherDao;
import com.pcloud.book.group.dto.JoinGroupCiperDTO;
import com.pcloud.book.group.entity.JoinGroupCipher;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/8/5 16:18
**/
@Component("joinGroupCipherDao")
public class JoinGroupCipherDaoImpl extends BaseDaoImpl<JoinGroupCipher> implements JoinGroupCipherDao {
@Override
public JoinGroupCipher getByCreateUser(Long wechatUserId,Long classifyId) {
Map<String,Object> map=new HashMap<>();
map.put("wechatUserId",wechatUserId);
map.put("classifyId",classifyId);
return this.getSqlSession().selectOne(this.getStatement("getByCreateUser"), map);
}
@Override
public JoinGroupCipher getByCipher(String cipher) {
return this.getSqlSession().selectOne(this.getStatement("getByCipher"), cipher);
}
@Override
public JoinGroupCiperDTO getDTOByCipher(String cipher) {
return this.getSqlSession().selectOne(this.getStatement("getDTOByCipher"), cipher);
}
@Override
public void updateCipherStateToUsed(String cipher, String wxId) {
Map<String,Object> map=new HashMap<>();
map.put("cipher",cipher);
map.put("wxId",wxId);
this.getSqlSession().update(this.getStatement("updateCipherStateToUsed"), map);
}
}
package com.pcloud.book.group.dao.impl;
import com.pcloud.book.group.dao.TempletRelevanceDao;
import com.pcloud.book.group.entity.TempletRelevance;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/8/5 16:19
**/
@Component("templetRelevanceDao")
public class TempletRelevanceDaoImpl extends BaseDaoImpl<TempletRelevance> implements TempletRelevanceDao {
@Override
public TempletRelevance getByTempletId(Long templetId) {
return this.getSqlSession().selectOne(this.getStatement("getByTempletId"), templetId);
}
}
...@@ -154,4 +154,12 @@ public class WeixinQrcodeDaoImpl extends BaseDaoImpl<WeixinQrcode> implements We ...@@ -154,4 +154,12 @@ public class WeixinQrcodeDaoImpl extends BaseDaoImpl<WeixinQrcode> implements We
public String getVirtualIp(Integer generation) { public String getVirtualIp(Integer generation) {
return this.getSessionTemplate().selectOne("getVirtualIp", generation); return this.getSessionTemplate().selectOne("getVirtualIp", generation);
} }
@Override
public Integer countByState(Integer state, List<String> altIds) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("state", state);
paramMap.put("altIds", altIds);
return this.getSessionTemplate().selectOne("countByState", paramMap);
}
} }
...@@ -142,6 +142,11 @@ public class BookGroupDTO extends BaseDto { ...@@ -142,6 +142,11 @@ public class BookGroupDTO extends BaseDto {
*/ */
private Boolean isShowBookName; private Boolean isShowBookName;
/**
* 进群方式:1群二维码,2客服机器人
*/
private Integer joinGroupType;
public String getUrl() { public String getUrl() {
return url; return url;
} }
...@@ -359,6 +364,14 @@ public class BookGroupDTO extends BaseDto { ...@@ -359,6 +364,14 @@ public class BookGroupDTO extends BaseDto {
this.isShowBookName = isShowBookName; this.isShowBookName = isShowBookName;
} }
public Integer getJoinGroupType() {
return joinGroupType;
}
public void setJoinGroupType(Integer joinGroupType) {
this.joinGroupType = joinGroupType;
}
@Override @Override
public String toString() { public String toString() {
return "BookGroupDTO{" + return "BookGroupDTO{" +
...@@ -388,7 +401,8 @@ public class BookGroupDTO extends BaseDto { ...@@ -388,7 +401,8 @@ public class BookGroupDTO extends BaseDto {
", bookName='" + bookName + '\'' + ", bookName='" + bookName + '\'' +
", url='" + url + '\'' + ", url='" + url + '\'' +
", bookClockInfoId=" + bookClockInfoId + ", bookClockInfoId=" + bookClockInfoId +
", isShowBookName='" + isShowBookName + '\'' + ", isShowBookName=" + isShowBookName +
", joinGroupType=" + joinGroupType +
"} " + super.toString(); "} " + super.toString();
} }
} }
\ No newline at end of file
...@@ -82,6 +82,8 @@ public class ClassifyDTO implements Serializable { ...@@ -82,6 +82,8 @@ public class ClassifyDTO implements Serializable {
private Long bookClockInfoId; private Long bookClockInfoId;
private Long createUser;
public Integer getRank() { public Integer getRank() {
return rank; return rank;
} }
...@@ -194,6 +196,14 @@ public class ClassifyDTO implements Serializable { ...@@ -194,6 +196,14 @@ public class ClassifyDTO implements Serializable {
this.bookClockInfoId = bookClockInfoId; this.bookClockInfoId = bookClockInfoId;
} }
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
@Override @Override
public String toString() { public String toString() {
return "ClassifyDTO{" + return "ClassifyDTO{" +
...@@ -211,6 +221,7 @@ public class ClassifyDTO implements Serializable { ...@@ -211,6 +221,7 @@ public class ClassifyDTO implements Serializable {
", changeNumber=" + changeNumber + ", changeNumber=" + changeNumber +
", rank=" + rank + ", rank=" + rank +
", bookClockInfoId=" + bookClockInfoId + ", bookClockInfoId=" + bookClockInfoId +
", createUser=" + createUser +
'}'; '}';
} }
} }
package com.pcloud.book.group.dto;
import lombok.Data;
@Data
public class JoinGroupCiperDTO {
private String cipher;
private Long classifyId;
private Long createUser;
private String wxId;
private Boolean hasUsed;
private Long bookGroupId;
}
package com.pcloud.book.group.dto;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/8/5 17:14
**/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class OwnAltQrcodeInfoDTO implements Serializable {
@ApiModelProperty("小号id")
private String altId;
@ApiModelProperty("小号昵称")
private String altNickName;
@ApiModelProperty("小号头像")
private String altHeadUrl;
@ApiModelProperty("小号二维码地址")
private String altQrcodeUrl;
@ApiModelProperty("暗号")
private String cipher;
public String getAltId() {
return altId;
}
public void setAltId(String altId) {
this.altId = altId;
}
public String getAltNickName() {
return altNickName;
}
public void setAltNickName(String altNickName) {
this.altNickName = altNickName;
}
public String getAltHeadUrl() {
return altHeadUrl;
}
public void setAltHeadUrl(String altHeadUrl) {
this.altHeadUrl = altHeadUrl;
}
public String getAltQrcodeUrl() {
return altQrcodeUrl;
}
public void setAltQrcodeUrl(String altQrcodeUrl) {
this.altQrcodeUrl = altQrcodeUrl;
}
public String getCipher() {
return cipher;
}
public void setCipher(String cipher) {
this.cipher = cipher;
}
@Override
public String toString() {
return "OwnAltQrcodeInfoDTO{" +
"altId='" + altId + '\'' +
", altNickName='" + altNickName + '\'' +
", altHeadUrl='" + altHeadUrl + '\'' +
", altQrcodeUrl='" + altQrcodeUrl + '\'' +
", cipher='" + cipher + '\'' +
'}';
}
}
...@@ -102,6 +102,11 @@ public class BookGroup extends BaseEntity { ...@@ -102,6 +102,11 @@ public class BookGroup extends BaseEntity {
*/ */
private Boolean isShowBookName; private Boolean isShowBookName;
/**
* 进群方式:1群二维码,2客服机器人
*/
private Integer joinGroupType;
public Long getId() { public Long getId() {
return id; return id;
} }
...@@ -246,6 +251,14 @@ public class BookGroup extends BaseEntity { ...@@ -246,6 +251,14 @@ public class BookGroup extends BaseEntity {
this.isShowBookName = isShowBookName; this.isShowBookName = isShowBookName;
} }
public Integer getJoinGroupType() {
return joinGroupType;
}
public void setJoinGroupType(Integer joinGroupType) {
this.joinGroupType = joinGroupType;
}
@Override @Override
public String toString() { public String toString() {
return "BookGroup{" + return "BookGroup{" +
...@@ -267,6 +280,7 @@ public class BookGroup extends BaseEntity { ...@@ -267,6 +280,7 @@ public class BookGroup extends BaseEntity {
", updateTime=" + updateTime + ", updateTime=" + updateTime +
", isDelete=" + isDelete + ", isDelete=" + isDelete +
", isShowBookName=" + isShowBookName + ", isShowBookName=" + isShowBookName +
", joinGroupType=" + joinGroupType +
"} " + super.toString(); "} " + super.toString();
} }
} }
\ No newline at end of file
package com.pcloud.book.group.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/8/5 15:59
**/
public class JoinGroupCipher extends BaseEntity {
private static final long serialVersionUID = -8724831387632496417L;
@ApiModelProperty("密码")
private String cipher;
@ApiModelProperty("分类id")
private Long classifyId;
@ApiModelProperty("创建人")
private Long createUser;
@ApiModelProperty("使用人微信id")
private String wxId;
@ApiModelProperty("是否使用")
private Boolean hasUsed;
public String getCipher() {
return cipher;
}
public void setCipher(String cipher) {
this.cipher = cipher;
}
public Long getClassifyId() {
return classifyId;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
public String getWxId() {
return wxId;
}
public void setWxId(String wxId) {
this.wxId = wxId;
}
public Boolean getHasUsed() {
return hasUsed;
}
public void setHasUsed(Boolean hasUsed) {
this.hasUsed = hasUsed;
}
@Override
public String toString() {
return "JoinGroupCipher{" +
"cipher='" + cipher + '\'' +
", classifyId=" + classifyId +
", createUser=" + createUser +
", wxId='" + wxId + '\'' +
", hasUsed=" + hasUsed +
"} " + super.toString();
}
}
package com.pcloud.book.group.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
/**
* @Description 分类关联表
* @Author ruansiyuan
* @Date 2019/8/5 15:47
**/
public class TempletRelevance extends BaseEntity {
private static final long serialVersionUID = 5014986282950538055L;
@ApiModelProperty("分类id")
private Long templetId;
@ApiModelProperty("大类id")
private Integer largeTemplet;
public Long getTempletId() {
return templetId;
}
public void setTempletId(Long templetId) {
this.templetId = templetId;
}
public Integer getLargeTemplet() {
return largeTemplet;
}
public void setLargeTemplet(Integer largeTemplet) {
this.largeTemplet = largeTemplet;
}
@Override
public String toString() {
return "TempletRelevance{" +
"templetId=" + templetId +
", largeTemplet=" + largeTemplet +
"} " + super.toString();
}
}
package com.pcloud.book.group.enums;
public enum LargTempletEnum {
/**
* K12类
*/
K12(1, "K12类"),
/**
* 少儿类
*/
CHILD(2, "少儿类"),
/**
* 高等/职教
*/
HIGH(3, "高等/职教"),
/**
* 大众类
*/
GENERAL(4, "大众类");
public final Integer code;
public final String name;
LargTempletEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
}
...@@ -3,13 +3,7 @@ package com.pcloud.book.group.facade; ...@@ -3,13 +3,7 @@ package com.pcloud.book.group.facade;
import com.pcloud.book.group.entity.BookGroupClassify; import com.pcloud.book.group.entity.BookGroupClassify;
import org.codehaus.jackson.JsonParseException; import org.codehaus.jackson.JsonParseException;
import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
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 com.pcloud.book.group.entity.BookGroup; import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.vo.UpdateRankTypeVO; import com.pcloud.book.group.vo.UpdateRankTypeVO;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
...@@ -251,4 +245,16 @@ public interface BookGroupFacade { ...@@ -251,4 +245,16 @@ public interface BookGroupFacade {
@RequestHeader("token") String token @RequestHeader("token") String token
) throws BizException, PermissionException, JsonParseException; ) throws BizException, PermissionException, JsonParseException;
@ApiOperation("根据分类id获取个人二维码")
@GetMapping("getOwnAltQrcodeInfoDTOByClassifyId")
ResponseDto<?> getOwnAltQrcodeInfoDTOByClassifyId(
@CookieValue("userInfo") String userInfo,
@RequestParam("classifyId") Long classifyId
) throws BizException, PermissionException, JsonParseException;
@ApiOperation("获取所有的大类")
@GetMapping("getAllLargeTemplet")
ResponseDto<?> getAllLargeTemplet(
@RequestHeader("token") String token
) throws BizException, PermissionException, JsonParseException;
} }
...@@ -13,18 +13,12 @@ import com.pcloud.common.page.PageBean; ...@@ -13,18 +13,12 @@ import com.pcloud.common.page.PageBean;
import com.pcloud.common.page.PageParam; import com.pcloud.common.page.PageParam;
import com.pcloud.common.permission.PermissionException; import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.SessionUtil; import com.pcloud.common.utils.SessionUtil;
import com.pcloud.common.utils.cookie.Cookie;
import com.pcloud.common.utils.string.StringUtil; import com.pcloud.common.utils.string.StringUtil;
import org.codehaus.jackson.JsonParseException; import org.codehaus.jackson.JsonParseException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
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.HashMap;
import java.util.Map; import java.util.Map;
...@@ -371,4 +365,30 @@ public class BookGroupFacadeImpl implements BookGroupFacade { ...@@ -371,4 +365,30 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID); Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(bookGroupBiz.getIsShowBookName(partyId)); return new ResponseDto<>(bookGroupBiz.getIsShowBookName(partyId));
} }
@ApiOperation("根据分类id获取个人二维码")
@GetMapping("getOwnAltQrcodeInfoDTOByClassifyId")
@Override
public ResponseDto<?> getOwnAltQrcodeInfoDTOByClassifyId(
@CookieValue("userInfo") String userInfo,
@RequestParam("classifyId") Long classifyId
) throws BizException, PermissionException, JsonParseException {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
if (classifyId == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "分类不能为空!");
}
return new ResponseDto<>(bookGroupBiz.getOwnAltQrcodeInfoDTOByClassifyId(wechatUserId, classifyId));
}
@ApiOperation("获取所有的大类")
@GetMapping("getAllLargeTemplet")
@Override
public ResponseDto<?> getAllLargeTemplet(
@RequestHeader("token") String token
) throws BizException, PermissionException, JsonParseException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(bookGroupBiz.getAllLargTemplet());
}
} }
...@@ -2,13 +2,12 @@ package com.pcloud.book.group.service.impl; ...@@ -2,13 +2,12 @@ package com.pcloud.book.group.service.impl;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.pcloud.book.group.dto.GroupUseDTO;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.pcloud.book.group.biz.BookGroupBiz; import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.dto.BookGroupDTO; import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.service.BookGroupService; import com.pcloud.book.group.service.BookGroupService;
...@@ -54,4 +53,34 @@ public class BookGroupServiceImpl implements BookGroupService { ...@@ -54,4 +53,34 @@ public class BookGroupServiceImpl implements BookGroupService {
return ResponseHandleUtil.toResponse(bookGroupBiz.getBaseInfoBySceneId(sceneId)); return ResponseHandleUtil.toResponse(bookGroupBiz.getBaseInfoBySceneId(sceneId));
} }
/**
* 获取暗号状态
*/
@ApiOperation("获取暗号状态")
@GetMapping("/getCipherState")
@Override
public ResponseEntity<ResponseDto<Integer>> getCipherState(String cipher) throws BizException {
return ResponseHandleUtil.toResponse(bookGroupBiz.getCipherState(cipher));
}
/**
* 更新密码状态为已使用
*/
@ApiOperation("更新暗号状态为已使用")
@GetMapping("/updateCipherStateToUsed")
@Override
public void updateCipherStateToUsed(String cipher, String wxId) throws BizException {
bookGroupBiz.updateCipherStateToUsed(cipher,wxId);
}
/**
* 获取个人二维码方式群已使用和未使用数量
*/
@ApiOperation("获取个人二维码方式群已使用和未使用数量")
@PostMapping("/getGroupUse")
@Override
public ResponseEntity<ResponseDto<GroupUseDTO>> getGroupUse(@RequestBody List<String> altIds) throws BizException {
return ResponseHandleUtil.toResponse(bookGroupBiz.getGroupUse(altIds));
}
} }
...@@ -5,11 +5,13 @@ import com.fasterxml.jackson.annotation.JsonInclude; ...@@ -5,11 +5,13 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable; import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/** /**
* @author lily * @author lily
* @date 2019/5/6 16:08 * @date 2019/5/6 16:08
*/ */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class GroupQrcodeBaseInfoVO implements Serializable { public class GroupQrcodeBaseInfoVO implements Serializable {
...@@ -22,36 +24,7 @@ public class GroupQrcodeBaseInfoVO implements Serializable { ...@@ -22,36 +24,7 @@ public class GroupQrcodeBaseInfoVO implements Serializable {
@ApiModelProperty("二维码地址") @ApiModelProperty("二维码地址")
private String qrcodeUrl; private String qrcodeUrl;
public Long getGroupQrcodeId() { @ApiModelProperty(value = "二维码地址", hidden = true)
return groupQrcodeId; private String weixinGroupId;
}
public void setGroupQrcodeId(Long groupQrcodeId) {
this.groupQrcodeId = groupQrcodeId;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public String getQrcodeUrl() {
return qrcodeUrl;
}
public void setQrcodeUrl(String qrcodeUrl) {
this.qrcodeUrl = qrcodeUrl;
}
@Override
public String toString() {
return "GroupQrcodeBaseInfoVO{" +
"groupQrcodeId=" + groupQrcodeId +
", groupName='" + groupName + '\'' +
", qrcodeUrl='" + qrcodeUrl + '\'' +
'}';
}
} }
...@@ -13,13 +13,16 @@ import com.pcloud.book.group.dao.AppTouchRecordDao; ...@@ -13,13 +13,16 @@ import com.pcloud.book.group.dao.AppTouchRecordDao;
import com.pcloud.book.group.dao.BookGroupClassifyDao; import com.pcloud.book.group.dao.BookGroupClassifyDao;
import com.pcloud.book.group.dao.BookGroupDao; import com.pcloud.book.group.dao.BookGroupDao;
import com.pcloud.book.group.dao.GroupQrcodeDao; import com.pcloud.book.group.dao.GroupQrcodeDao;
import com.pcloud.book.group.dao.JoinGroupCipherDao;
import com.pcloud.book.group.dto.BookGroupDTO; import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.GroupClassifyQrcodeDTO; import com.pcloud.book.group.dto.GroupClassifyQrcodeDTO;
import com.pcloud.book.group.dto.JoinGroupCiperDTO;
import com.pcloud.book.group.dto.PushAddUserMessageDTO; 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;
import com.pcloud.book.group.tools.SendWeixinRequestTools; import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.group.vo.GroupQrcode4ClassifyVO;
import com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO; import com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO;
import com.pcloud.book.keywords.biz.BookGuideBiz; import com.pcloud.book.keywords.biz.BookGuideBiz;
import com.pcloud.book.keywords.biz.BookKeywordBiz; import com.pcloud.book.keywords.biz.BookKeywordBiz;
...@@ -41,6 +44,7 @@ import com.pcloud.common.utils.UUIDUitl; ...@@ -41,6 +44,7 @@ import com.pcloud.common.utils.UUIDUitl;
import com.pcloud.common.utils.rsa.AESCodec; import com.pcloud.common.utils.rsa.AESCodec;
import com.pcloud.common.utils.string.StringUtil; import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.wechatgroup.message.dto.AgreeAddUserDTO; import com.pcloud.wechatgroup.message.dto.AgreeAddUserDTO;
import com.sdk.wxgroup.AddToGroupVO;
import com.sdk.wxgroup.SendMessageTypeEnum; import com.sdk.wxgroup.SendMessageTypeEnum;
import com.sdk.wxgroup.SendTextMessageVO; import com.sdk.wxgroup.SendTextMessageVO;
import com.sdk.wxgroup.WxGroupSDK; import com.sdk.wxgroup.WxGroupSDK;
...@@ -93,6 +97,8 @@ public class BookGuideBizImpl implements BookGuideBiz { ...@@ -93,6 +97,8 @@ public class BookGuideBizImpl implements BookGuideBiz {
private GroupQrcodeDao groupQrcodeDao; private GroupQrcodeDao groupQrcodeDao;
@Autowired @Autowired
private BookGroupClassifyDao bookGroupClassifyDao; private BookGroupClassifyDao bookGroupClassifyDao;
@Autowired
private JoinGroupCipherDao joinGroupCipherDao;
@ParamLog("同意加好友发送欢迎语") @ParamLog("同意加好友发送欢迎语")
@Override @Override
...@@ -111,10 +117,25 @@ public class BookGuideBizImpl implements BookGuideBiz { ...@@ -111,10 +117,25 @@ public class BookGuideBizImpl implements BookGuideBiz {
vo.setCode(SendMessageTypeEnum.SELF.getCode()); vo.setCode(SendMessageTypeEnum.SELF.getCode());
vo.setWxId(agreeAddUserDTO.getRobotWxId()); vo.setWxId(agreeAddUserDTO.getRobotWxId());
vo.setGroupId(agreeAddUserDTO.getUserWxId()); vo.setGroupId(agreeAddUserDTO.getUserWxId());
log.info("[同意加好友发送欢迎语] : {}", vo);
WxGroupSDK.sendTextMessage(vo); WxGroupSDK.sendTextMessage(vo);
// TODO 推送关键词欢迎语 // 根据暗号获取分类id和bookGroupId推送关键词欢迎语
List<KeywordDTO> keywords = bookKeywordBiz.listFiveKeyword(classifyQrcodeInfo.getClassifyId(), classifyQrcodeInfo.getBookGroupId()); final JoinGroupCiperDTO dto = joinGroupCipherDao.getDTOByCipher(cipher);
List<KeywordDTO> keywords = bookKeywordBiz.listFiveKeyword(dto.getClassifyId(), dto.getBookGroupId());
SendWeixinRequestTools.sendKeywordsInfo(keywords, agreeAddUserDTO.getRobotWxId(), agreeAddUserDTO.getUserWxId(), agreeAddUserDTO.getIp()); SendWeixinRequestTools.sendKeywordsInfo(keywords, agreeAddUserDTO.getRobotWxId(), agreeAddUserDTO.getUserWxId(), agreeAddUserDTO.getIp());
// 拉群
final String wxGroupId = bookGroupClassifyBiz.getWxGroupIdByClassifyIdAndWechatId(dto.getClassifyId(), dto.getCreateUser());
if (StringUtil.isBlank(wxGroupId)) {
log.info("[同意加好友发送欢迎语] 拉群 没有找到群 bookGroupClassifyBiz.getGroupQrcode4ClassifyWechat JoinGroupCiperDTO :{}", dto);
return;
}
AddToGroupVO vo1 = new AddToGroupVO();
vo1.setWxGroupId(wxGroupId);
vo1.setWxId(agreeAddUserDTO.getUserWxId());
vo1.setAltId(agreeAddUserDTO.getRobotWxId());
vo1.setIp(agreeAddUserDTO.getIp());
log.info("[同意加好友发送欢迎语 拉群] AddToGroupVO :{}", vo1);
WxGroupSDK.addToGroup(vo1);
} }
@Override @Override
......
...@@ -159,7 +159,7 @@ ...@@ -159,7 +159,7 @@
product_id productId, product_id productId,
product_spec_id productSpecId, product_spec_id productSpecId,
change_number changeNumber, change_number changeNumber,
create_user create_user createUser
from from
book_group_classify book_group_classify
where where
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/> <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
<result column="is_delete" property="isDelete" jdbcType="BIT"/> <result column="is_delete" property="isDelete" jdbcType="BIT"/>
<result column="is_show_book_name" property="isShowBookName" jdbcType="BOOLEAN"/> <result column="is_show_book_name" property="isShowBookName" jdbcType="BOOLEAN"/>
<result column="join_group_type" property="joinGroupType" jdbcType="INTEGER"/>
</resultMap> </resultMap>
<resultMap id="BookGroupDTO" type="com.pcloud.book.group.dto.BookGroupDTO"> <resultMap id="BookGroupDTO" type="com.pcloud.book.group.dto.BookGroupDTO">
...@@ -45,13 +46,14 @@ ...@@ -45,13 +46,14 @@
<result column="BOOK_NAME" property="bookName" jdbcType="VARCHAR"/> <result column="BOOK_NAME" property="bookName" jdbcType="VARCHAR"/>
<result column="book_clock_info_id" property="bookClockInfoId" jdbcType="BIGINT"/> <result column="book_clock_info_id" property="bookClockInfoId" jdbcType="BIGINT"/>
<result column="is_show_book_name" property="isShowBookName" jdbcType="BOOLEAN"/> <result column="is_show_book_name" property="isShowBookName" jdbcType="BOOLEAN"/>
<result column="join_group_type" property="joinGroupType" jdbcType="INTEGER"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, book_id, channel_id, scene_id, group_qrcode_url, group_qrcode_name, pro_label_id, dep_label_id, id, book_id, channel_id, scene_id, group_qrcode_url, group_qrcode_name, pro_label_id, dep_label_id,
pur_label_id, join_title, join_slogan, personal_qrcode_url, product_id, create_user, pur_label_id, join_title, join_slogan, personal_qrcode_url, product_id, create_user,
create_time, create_time,
update_time, is_delete, is_show_book_name update_time, is_delete, is_show_book_name,join_group_type
</sql> </sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long"> <select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
...@@ -224,6 +226,9 @@ ...@@ -224,6 +226,9 @@
<if test="sceneId != null and sceneId != 0"> <if test="sceneId != null and sceneId != 0">
scene_id = #{sceneId}, scene_id = #{sceneId},
</if> </if>
<if test="joinGroupType != null">
join_group_type = #{joinGroupType},
</if>
update_time = NOW(), update_time = NOW(),
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
......
...@@ -176,7 +176,7 @@ ...@@ -176,7 +176,7 @@
<select id="getBaseById" parameterType="Long" resultType="GroupQrcodeBaseInfoVO"> <select id="getBaseById" parameterType="Long" resultType="GroupQrcodeBaseInfoVO">
select select
id groupQrcodeId, group_name groupName,qrcode_url qrcodeUrl id groupQrcodeId, group_name groupName,qrcode_url qrcodeUrl, weixin_group_id as weixinGroupId
from from
book_group_qrcode book_group_qrcode
where where
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.group.dao.impl.JoinGroupCipherDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.group.entity.JoinGroupCipher">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="cipher" property="cipher" jdbcType="VARCHAR"/>
<result column="classify_id" property="classifyId" jdbcType="BIGINT"/>
<result column="create_user" property="createUser" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
<result column="wx_id" property="wxId" jdbcType="BIGINT"/>
<result column="has_used" property="hasUsed" jdbcType="BOOLEAN"/>
</resultMap>
<sql id="Base_Column_List">
id, cipher, classify_id, create_time, create_user, update_time, wx_id, has_used
</sql>
<insert id="insert" parameterType="com.pcloud.book.group.entity.JoinGroupCipher" useGeneratedKeys="true"
keyProperty="id">
insert into join_group_cipher
<trim prefix="(" suffix=")" suffixOverrides=",">
cipher,
classify_id,
create_time,
create_user,
has_used
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{cipher,jdbcType=BIGINT},
#{classifyId,jdbcType=BIGINT},
now(),
#{createUser,jdbcType=BIGINT},
0
</trim>
</insert>
<!--获取基本信息-->
<select id="getByCreateUser" parameterType="map" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> from join_group_cipher
where create_user=#{wechatUserId} and
classify_id=#{classifyId}
</select>
<!--根据暗号获取-->
<select id="getByCipher" parameterType="String" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> from join_group_cipher
where cipher=#{cipher} limit 1
</select>
<!--根据暗号获取包含bookGroupId-->
<select id="getDTOByCipher" parameterType="String" resultType="com.pcloud.book.group.dto.JoinGroupCiperDTO">
select
a.id, cipher, a.classify_id as classifyId, a.create_user as createUser, a.wx_id as wxId,
a.has_used as hasUsed, b.book_group_id as bookGroupId
from join_group_cipher a left join book_group_classify b on a.classify_id = b.id
where a.cipher=#{cipher} limit 1
</select>
<!--更新暗号状态为已使用-->
<update id="updateCipherStateToUsed" parameterType="map">
update join_group_cipher set
has_used=1,
wx_id=#{wxId},
update_time=now()
where cipher=#{cipher}
</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" "mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.group.dao.impl.TempletRelevanceDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.group.entity.TempletRelevance">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="templet_id" property="templetId" jdbcType="BIGINT"/>
<result column="large_templet" property="largeTemplet" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
id, templet_id, large_templet
</sql>
<insert id="insert" parameterType="com.pcloud.book.group.entity.TempletRelevance" useGeneratedKeys="true"
keyProperty="id">
insert into templet_relevance
<trim prefix="(" suffix=")" suffixOverrides=",">
templet_id,
large_templet
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{templetId,jdbcType=BIGINT},
#{largeTemplet,jdbcType=INTEGER}
</trim>
</insert>
<!--根据模板id查询大类id-->
<select id="getByTempletId" parameterType="Long" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> from templet_relevance
where templet_id=#{templetId} order by id desc limit 1
</select>
</mapper>
\ No newline at end of file
...@@ -275,4 +275,12 @@ ...@@ -275,4 +275,12 @@
where generation = #{_parameter} where generation = #{_parameter}
</select> </select>
<!--根据状态获取群数量-->
<select id="countByState" parameterType="map" resultType="Integer">
select count(1) from weixin_qrcode t where t.robot_wx_id in
<foreach collection="altIds" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
and use_state=#{state}
</select>
</mapper> </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