Commit 199359f3 by 裴大威

Merge branch 'feat-dx-1001710' into 'master'

添加内部接口,topic

See merge request rays/pcloud-book!177
parents 7add7d77 d1049a55
package com.pcloud.book.group.dto;
import java.io.Serializable;
/**
* @author 戴兴
* @description TODO
* @date 2019/9/20 17:43
*/
public class UpdateGroupNameDTO implements Serializable {
/**
* 二维码标识
*/
private Long id;
/**
* 微信群id
*/
private String groupName;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
@Override
public String toString() {
return "UpdateGroupNameDTO{" +
"id=" + id +
", groupName='" + groupName + '\'' +
'}';
}
}
\ No newline at end of file
package com.pcloud.book.group.service; package com.pcloud.book.group.service;
import com.pcloud.book.group.dto.BookWxQrcodeDTO; import com.pcloud.book.group.dto.*;
import com.pcloud.book.group.dto.SyncWeixinGroupIdDTO;
import com.pcloud.book.group.dto.UpdateQrDTO;
import com.pcloud.book.group.dto.WeixinQrcodeCountDTO;
import com.pcloud.book.group.dto.WeixinQrcodeDTO;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
...@@ -87,6 +83,14 @@ public interface WeixinQrcodeService { ...@@ -87,6 +83,14 @@ public interface WeixinQrcodeService {
@RequestMapping(value = "getWxGroupId", method = RequestMethod.GET) @RequestMapping(value = "getWxGroupId", method = RequestMethod.GET)
ResponseEntity<ResponseDto<String>> getWxGroupId(@RequestParam("classifyId") Long classifyId); ResponseEntity<ResponseDto<String>> getWxGroupId(@RequestParam("classifyId") Long classifyId);
@ApiOperation(value = "通过qrcodeId获取微信群信息", httpMethod = "GET")
@RequestMapping(value = "getWxGroupInfoById", method = RequestMethod.GET)
ResponseEntity<ResponseDto<GroupQrcodeInfo4Advertising>> getWxGroupInfoById(@RequestParam("qrcodeId") Long qrcodeId);
@ApiOperation(value = "通过qrcodeIds获取微信群信息", httpMethod = "POST")
@RequestMapping(value = "getWxGroupInfoByIds", method = RequestMethod.POST)
ResponseEntity<ResponseDto<Map<Long, GroupQrcodeInfo4Advertising>>> getWxGroupInfoByIds(@RequestBody List<Long> qrcodeIds);
} }
...@@ -184,4 +184,18 @@ public interface GroupQrcodeBiz { ...@@ -184,4 +184,18 @@ public interface GroupQrcodeBiz {
* @return * @return
*/ */
PageBeanNew<GroupRiddleDTO> listPageRiddle(Long partyId, Integer currentPage, Integer numPerPage, String name); PageBeanNew<GroupRiddleDTO> listPageRiddle(Long partyId, Integer currentPage, Integer numPerPage, String name);
/**
* @description 获取微信群信息
* @author 戴兴
* @date 2019/9/20 16:36
*/
GroupQrcodeInfo4Advertising getWechatGroupInfo(Long qrcodeId);
/**
* @description 批量获取微信群信息
* @author 戴兴
* @date 2019/9/21 19:10
*/
Map<Long, GroupQrcodeInfo4Advertising> getWechatGroupInfoMap(List<Long> qrcodeIds);
} }
...@@ -28,6 +28,7 @@ import com.pcloud.book.group.dto.GroupQrcodeServerDTO; ...@@ -28,6 +28,7 @@ import com.pcloud.book.group.dto.GroupQrcodeServerDTO;
import com.pcloud.book.group.dto.PushAddUserMessageDTO; import com.pcloud.book.group.dto.PushAddUserMessageDTO;
import com.pcloud.book.group.dto.QrcodeNameAndProIdDTO; import com.pcloud.book.group.dto.QrcodeNameAndProIdDTO;
import com.pcloud.book.group.dto.WeixinQrcodeDTO; import com.pcloud.book.group.dto.WeixinQrcodeDTO;
import com.pcloud.book.group.dto.*;
import com.pcloud.book.group.entity.GroupQrcode; import com.pcloud.book.group.entity.GroupQrcode;
import com.pcloud.book.group.enums.QrcodeStatusEnum; import com.pcloud.book.group.enums.QrcodeStatusEnum;
import com.pcloud.book.group.tools.SendWeixinRequestTools; import com.pcloud.book.group.tools.SendWeixinRequestTools;
...@@ -47,6 +48,7 @@ import com.pcloud.book.riddle.dto.GroupRiddleDTO; ...@@ -47,6 +48,7 @@ import com.pcloud.book.riddle.dto.GroupRiddleDTO;
import com.pcloud.book.util.common.ThreadPoolUtils; import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.common.constant.CacheConstant; import com.pcloud.common.constant.CacheConstant;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.core.constant.MQTopicProducer;
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.ListUtils; import com.pcloud.common.utils.ListUtils;
...@@ -58,6 +60,7 @@ import com.sdk.wxgroup.WxGroupSDK; ...@@ -58,6 +60,7 @@ import com.sdk.wxgroup.WxGroupSDK;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -111,6 +114,8 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz { ...@@ -111,6 +114,8 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
private BookGroupBiz bookGroupBiz; private BookGroupBiz bookGroupBiz;
@Autowired @Autowired
private GroupTagBiz groupTagBiz; private GroupTagBiz groupTagBiz;
@Autowired
private AmqpTemplate amqpTemplate;
/** /**
...@@ -436,6 +441,10 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz { ...@@ -436,6 +441,10 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
String ip = Optional.ofNullable(groupVersion.get(wechatGroupId)).orElse(new BookWxQrcodeDTO()).getWechatGroupIp(); String ip = Optional.ofNullable(groupVersion.get(wechatGroupId)).orElse(new BookWxQrcodeDTO()).getWechatGroupIp();
SendWeixinRequestTools.changeGroupName(robotId, changeGroupNameDTO.getWxGroupId(), wechatGroupName, ip); SendWeixinRequestTools.changeGroupName(robotId, changeGroupNameDTO.getWxGroupId(), wechatGroupName, ip);
} }
UpdateGroupNameDTO updateGroupNameDTO = new UpdateGroupNameDTO();
updateGroupNameDTO.setId(id);
updateGroupNameDTO.setGroupName(wechatGroupName);
amqpTemplate.convertAndSend(MQTopicProducer.EXCHAGE, MQTopicProducer.MODIFY_WXGROUP_NAME, updateGroupNameDTO);
} }
@Override @Override
...@@ -797,4 +806,22 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz { ...@@ -797,4 +806,22 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
return pageBeanNew; return pageBeanNew;
} }
@Override
public GroupQrcodeInfo4Advertising getWechatGroupInfo(Long qrcodeId) {
GroupQrcode groupQrcode = groupQrcodeDao.getGroupQrcodeByqrcodeId(qrcodeId);
GroupQrcodeInfo4Advertising groupQrcodeInfo4Advertising = new GroupQrcodeInfo4Advertising();
groupQrcodeInfo4Advertising.setAdviserId(groupQrcode.getCreateUser());
groupQrcodeInfo4Advertising.setGroupName(groupQrcode.getGroupName());
groupQrcodeInfo4Advertising.setQrcodeUrl(groupQrcode.getQrcodeUrl());
return groupQrcodeInfo4Advertising;
}
@Override
public Map<Long, GroupQrcodeInfo4Advertising> getWechatGroupInfoMap(List<Long> qrcodeIds) {
if (ListUtils.isEmpty(qrcodeIds)){
return new HashMap<>();
}
return groupQrcodeDao.getWechatGroupInfoMap(qrcodeIds);
}
} }
...@@ -147,6 +147,13 @@ public interface GroupQrcodeDao extends BaseDao<GroupQrcode> { ...@@ -147,6 +147,13 @@ public interface GroupQrcodeDao extends BaseDao<GroupQrcode> {
GroupQrcode getGroupQrcodeByGroupId(String wechatGroupId); GroupQrcode getGroupQrcodeByGroupId(String wechatGroupId);
/** /**
* @description 根据qrcodeId获取微信群信息
* @author 戴兴
* @date 2019/9/20 16:40
*/
GroupQrcode getGroupQrcodeByqrcodeId(Long qrcodeId);
/**
* @Author: zhangdongwei * @Author: zhangdongwei
* 根据群分类ids获取群总数 * 根据群分类ids获取群总数
* @param classifyIds * @param classifyIds
...@@ -256,4 +263,5 @@ public interface GroupQrcodeDao extends BaseDao<GroupQrcode> { ...@@ -256,4 +263,5 @@ public interface GroupQrcodeDao extends BaseDao<GroupQrcode> {
List<ClassifyQrcodeVO> getQrcodeByClassifyId(Long classifyId); List<ClassifyQrcodeVO> getQrcodeByClassifyId(Long classifyId);
Map<Long, GroupQrcodeInfo4Advertising> getWechatGroupInfoMap(List<Long> qrcodeIds);
} }
...@@ -167,6 +167,11 @@ public class GroupQrcodeDaoImpl extends BaseDaoImpl<GroupQrcode> implements Grou ...@@ -167,6 +167,11 @@ public class GroupQrcodeDaoImpl extends BaseDaoImpl<GroupQrcode> implements Grou
} }
@Override @Override
public GroupQrcode getGroupQrcodeByqrcodeId(Long qrcodeId) {
return this.getSqlSession().selectOne(this.getStatement("getGroupQrcodeByqrcodeId"), qrcodeId);
}
@Override
public Integer countByClassifyIds(List<Long> classifyIds) { public Integer countByClassifyIds(List<Long> classifyIds) {
return this.getSqlSession().selectOne(this.getStatement("countByClassifyIds"), classifyIds); return this.getSqlSession().selectOne(this.getStatement("countByClassifyIds"), classifyIds);
} }
...@@ -239,6 +244,11 @@ public class GroupQrcodeDaoImpl extends BaseDaoImpl<GroupQrcode> implements Grou ...@@ -239,6 +244,11 @@ public class GroupQrcodeDaoImpl extends BaseDaoImpl<GroupQrcode> implements Grou
} }
@Override @Override
public Map<Long, GroupQrcodeInfo4Advertising> getWechatGroupInfoMap(List<Long> qrcodeIds) {
return this.getSqlSession().selectMap(this.getStatement("getWechatGroupInfoMap"), qrcodeIds,"groupQrcodeId");
}
@Override
public List<Long> getIdsByBookId(Long bookId) { public List<Long> getIdsByBookId(Long bookId) {
return getSessionTemplate().selectList(getStatement("getIdsByBookId"), bookId); return getSessionTemplate().selectList(getStatement("getIdsByBookId"), bookId);
} }
......
...@@ -2,11 +2,7 @@ package com.pcloud.book.group.service.impl; ...@@ -2,11 +2,7 @@ package com.pcloud.book.group.service.impl;
import com.pcloud.book.group.biz.GroupQrcodeBiz; import com.pcloud.book.group.biz.GroupQrcodeBiz;
import com.pcloud.book.group.biz.WeixinQrcodeBiz; import com.pcloud.book.group.biz.WeixinQrcodeBiz;
import com.pcloud.book.group.dto.BookWxQrcodeDTO; import com.pcloud.book.group.dto.*;
import com.pcloud.book.group.dto.SyncWeixinGroupIdDTO;
import com.pcloud.book.group.dto.UpdateQrDTO;
import com.pcloud.book.group.dto.WeixinQrcodeCountDTO;
import com.pcloud.book.group.dto.WeixinQrcodeDTO;
import com.pcloud.book.group.service.WeixinQrcodeService; import com.pcloud.book.group.service.WeixinQrcodeService;
import com.pcloud.book.group.vo.ClassifyQrcodeVO; import com.pcloud.book.group.vo.ClassifyQrcodeVO;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
...@@ -133,4 +129,18 @@ public class WeixinQrcodeServiceImpl implements WeixinQrcodeService { ...@@ -133,4 +129,18 @@ public class WeixinQrcodeServiceImpl implements WeixinQrcodeService {
return ResponseHandleUtil.toResponse(wxGroupId); return ResponseHandleUtil.toResponse(wxGroupId);
} }
@Override
@RequestMapping(value = "getWxGroupInfoById", method = RequestMethod.GET)
public ResponseEntity<ResponseDto<GroupQrcodeInfo4Advertising>> getWxGroupInfoById(@RequestParam("qrcodeId") Long qrcodeId) {
GroupQrcodeInfo4Advertising wechatGroupInfo = groupQrcodeBiz.getWechatGroupInfo(qrcodeId);
return ResponseHandleUtil.toResponse(wechatGroupInfo);
}
@Override
@RequestMapping(value = "getWxGroupInfoByIds", method = RequestMethod.POST)
public ResponseEntity<ResponseDto<Map<Long, GroupQrcodeInfo4Advertising>>> getWxGroupInfoByIds(@RequestBody List<Long> qrcodeIds) {
Map<Long, GroupQrcodeInfo4Advertising> wechatGroupInfoMap = groupQrcodeBiz.getWechatGroupInfoMap(qrcodeIds);
return ResponseHandleUtil.toResponse(wechatGroupInfoMap);
}
} }
...@@ -351,6 +351,11 @@ ...@@ -351,6 +351,11 @@
where is_delete=0 and weixin_group_id=#{wechatGroupId} limit 1 where is_delete=0 and weixin_group_id=#{wechatGroupId} limit 1
</select> </select>
<select id="getGroupQrcodeByqrcodeId" resultMap="BaseResultMap" parameterType="long">
select <include refid="Base_Column_List"/> from book_group_qrcode
where is_delete=0 and id=#{qrcodeId} limit 1
</select>
<select id="countByClassifyIds" parameterType="list" resultType="java.lang.Integer"> <select id="countByClassifyIds" parameterType="list" resultType="java.lang.Integer">
select count(1) from book_group_qrcode select count(1) from book_group_qrcode
where where
...@@ -695,4 +700,11 @@ ...@@ -695,4 +700,11 @@
from book_group_qrcode where classify_id = #{classifyId} and is_delete = 0 from book_group_qrcode where classify_id = #{classifyId} and is_delete = 0
</select> </select>
<select id="getWechatGroupInfoMap" parameterType="list" resultType="com.pcloud.book.group.dto.GroupQrcodeInfo4Advertising">
select id groupQrcodeId, group_name groupName, qrcode_url qrcodeUrl from book_group_qrcode where id in
<foreach collection="list" separator="," open="(" close=")" item="id">
#{id}
</foreach>
</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